From d4cafafddf59c04e774704076f94f58f510b9118 Mon Sep 17 00:00:00 2001 From: L3D Date: Thu, 20 Feb 2020 23:30:57 +0100 Subject: [PATCH] Optimize role order --- README.md | 3 +++ defaults/main.yml | 3 +++ tasks/copy_media_files.yml | 19 +++++++++++++++++++ tasks/main.yml | 38 ++++++++++++-------------------------- 4 files changed, 37 insertions(+), 26 deletions(-) create mode 100644 tasks/copy_media_files.yml diff --git a/README.md b/README.md index 602dd8d..5e9f54e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +[![Build Status](https://travis-ci.org/chaos-bodensee/role_akku_warning.svg?branch=master)](https://travis-ci.org/chaos-bodensee/role_akku_warning) +[![MIT License](https://raw.githubusercontent.com/chaos-bodensee/role_akku_warning/master/.github/license.svg?sanitize=true)](https://github.com/chaos-bodensee/role_akku_warning/blob/master/LICENSE) + Akku Warning role --------------------- diff --git a/defaults/main.yml b/defaults/main.yml index ccfbf59..111b3da 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -12,5 +12,8 @@ install_and_enable_cronie: false # play a video in the background with sound multimedia_akku_warning: true +# you want to install missing packages? +manage_packages_akku_warning: true + # version check for this playbook submodules_versioncheck: true diff --git a/tasks/copy_media_files.yml b/tasks/copy_media_files.yml new file mode 100644 index 0000000..8ed797a --- /dev/null +++ b/tasks/copy_media_files.yml @@ -0,0 +1,19 @@ +--- +- name: copy sound warning script + become: yes + template: + src: 'templates/akku.sh' + dest: '/opt/akku.sh' + owner: 'root' + group: 'root' + mode: '0755' + +- name: copy sound warning video + become: yes + copy: + src: "{{ akku_sound_src }}" + dest: "{{ akku_sound_dest }}" + owner: 'root' + group: 'root' + mode: '0644' + when: multimedia_akku_warning|bool diff --git a/tasks/main.yml b/tasks/main.yml index c9d5eb2..520a068 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -2,24 +2,7 @@ - include_tasks: versioncheck.yml when: submodules_versioncheck|bool -- name: copy sound warning script - become: yes - template: - src: 'templates/akku.sh' - dest: '/opt/akku.sh' - owner: 'root' - group: 'root' - mode: '0755' - -- name: copy sound warning video - become: yes - copy: - src: "{{ akku_sound_src }}" - dest: "{{ akku_sound_dest }}" - owner: 'root' - group: 'root' - mode: '0644' - when: multimedia_akku_warning|bool +- include_tasks: copy_media_files.yml - name: install zenity and mpv for notifications become: yes @@ -28,6 +11,17 @@ - zenity - mpv state: present + when: manage_packages_akku_warning | bool + +- name: Make sure cron is installed + become: true + package: + name: + - cronie + state: present + when: + - manage_packages_akku_warning | bool + - install_and_enable_cronie|bool - name: Check akku every 2 minutes become: yes @@ -38,14 +32,6 @@ user: '{{ akku_user }}' cron_file: /etc/crontab -- name: Make sure cron is installed - become: true - when: install_and_enable_cronie|bool - package: - name: - - cronie - state: present - - name: Make sure cron is running become: true when: install_and_enable_cronie|bool