mirror of
https://github.com/roles-ansible/role_akku_warning.git
synced 2024-08-16 10:09:50 +02:00
Implement akku warning
This commit is contained in:
parent
e71341cbea
commit
ce2be29432
5 changed files with 52 additions and 4 deletions
|
@ -3,7 +3,7 @@
|
|||
|
||||
This ansible warning will install an bash Script, that will be executet every 3 minutes.
|
||||
|
||||
If your batterie is under 25 min, it will make a warning.
|
||||
If your batterie is under 25 min, it will start warning you.
|
||||
|
||||
This role is only tested on arch, but probably will work on all distros!
|
||||
|
||||
|
|
|
@ -7,3 +7,6 @@ install_and_enable_cronie: false
|
|||
|
||||
# play a video in the background with sound
|
||||
multimedia_akku_warning: true
|
||||
|
||||
# version check for this playbook
|
||||
submodules_versioncheck: true
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
---
|
||||
- include_tasks: versioncheck.yml
|
||||
when: submodules_versioncheck|bool
|
||||
|
||||
- name: copy sound warning script
|
||||
become: yes
|
||||
copy:
|
||||
|
@ -16,7 +19,7 @@
|
|||
owner: 'root'
|
||||
group: 'root'
|
||||
mode: '0644'
|
||||
when: multimedia_akku_warning
|
||||
when: multimedia_akku_warning|bool
|
||||
|
||||
- name: install zenity and mpv for notifications
|
||||
become: yes
|
||||
|
@ -37,7 +40,7 @@
|
|||
|
||||
- name: Make sure cron is installed
|
||||
become: true
|
||||
when: install_and_enable_cronie
|
||||
when: install_and_enable_cronie|bool
|
||||
package:
|
||||
name:
|
||||
- cronie
|
||||
|
@ -45,7 +48,7 @@
|
|||
|
||||
- name: Make sure cron is running
|
||||
become: true
|
||||
when: install_and_enable_cronie
|
||||
when: install_and_enable_cronie|bool
|
||||
systemd:
|
||||
name: cronie.service
|
||||
state: started
|
||||
|
|
39
tasks/versioncheck.yml
Normal file
39
tasks/versioncheck.yml
Normal file
|
@ -0,0 +1,39 @@
|
|||
---
|
||||
- name: Create directory for versionscheck
|
||||
become: true
|
||||
file:
|
||||
path: '/etc/ansible-version'
|
||||
state: directory
|
||||
mode: 0755
|
||||
when: submodules_versioncheck|bool
|
||||
|
||||
- name: check playbook version
|
||||
become: true
|
||||
slurp:
|
||||
src: "{{ playbook_version_path }}"
|
||||
register: playbook_version
|
||||
when: submodules_versioncheck|bool
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Print remote role version
|
||||
debug:
|
||||
msg: "Remote role version: {{ playbook_version.content | default('Y3VycmVudGx5IG5vdCBkZXBsb3llZAo=') | b64decode | string }}"
|
||||
when: submodules_versioncheck|bool
|
||||
|
||||
- name: Print locale role version
|
||||
debug:
|
||||
msg: "Local role version: '{{ playbook_version_number|string }}'."
|
||||
when: submodules_versioncheck|bool
|
||||
|
||||
- name: Check if your version is outdated
|
||||
fail:
|
||||
msg: "Your ansible module has the version '{{ playbook_version_number }}' and is outdated. You need to update it!"
|
||||
when:
|
||||
- playbook_version.content|default("Mgo=")|b64decode|int - 1 >= playbook_version_number|int and submodules_versioncheck|bool
|
||||
|
||||
- name: write new version to remote disk
|
||||
become: true
|
||||
copy:
|
||||
content: "{{ playbook_version_number }}"
|
||||
dest: "{{ playbook_version_path }}"
|
||||
when: submodules_versioncheck|bool
|
3
vars/main.yml
Normal file
3
vars/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
playbook_version_number: 100
|
||||
playbook_version_path: '/etc/ansible-version/role-akku-warning_chaos-bodensee_github.com.version'
|
Loading…
Reference in a new issue