1
0
Fork 0
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:
Lilian Roller 2019-05-17 16:07:17 +02:00
parent e71341cbea
commit ce2be29432
No known key found for this signature in database
GPG key ID: 5215C3441797AB2B
5 changed files with 52 additions and 4 deletions

View file

@ -3,7 +3,7 @@
This ansible warning will install an bash Script, that will be executet every 3 minutes. 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! This role is only tested on arch, but probably will work on all distros!

View file

@ -7,3 +7,6 @@ install_and_enable_cronie: false
# play a video in the background with sound # play a video in the background with sound
multimedia_akku_warning: true multimedia_akku_warning: true
# version check for this playbook
submodules_versioncheck: true

View file

@ -1,4 +1,7 @@
--- ---
- include_tasks: versioncheck.yml
when: submodules_versioncheck|bool
- name: copy sound warning script - name: copy sound warning script
become: yes become: yes
copy: copy:
@ -16,7 +19,7 @@
owner: 'root' owner: 'root'
group: 'root' group: 'root'
mode: '0644' mode: '0644'
when: multimedia_akku_warning when: multimedia_akku_warning|bool
- name: install zenity and mpv for notifications - name: install zenity and mpv for notifications
become: yes become: yes
@ -37,7 +40,7 @@
- name: Make sure cron is installed - name: Make sure cron is installed
become: true become: true
when: install_and_enable_cronie when: install_and_enable_cronie|bool
package: package:
name: name:
- cronie - cronie
@ -45,7 +48,7 @@
- name: Make sure cron is running - name: Make sure cron is running
become: true become: true
when: install_and_enable_cronie when: install_and_enable_cronie|bool
systemd: systemd:
name: cronie.service name: cronie.service
state: started state: started

39
tasks/versioncheck.yml Normal file
View 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
View file

@ -0,0 +1,3 @@
---
playbook_version_number: 100
playbook_version_path: '/etc/ansible-version/role-akku-warning_chaos-bodensee_github.com.version'