1
0
Fork 0
mirror of https://github.com/roles-ansible/role_akku_warning.git synced 2024-08-16 10:09:50 +02:00

Merge pull request #2 from roles-ansible/docs

Update docs, improve testing and fix some typos
This commit is contained in:
L3D 2020-05-19 10:40:21 +02:00 committed by GitHub
commit c48845dbe2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 178 additions and 52 deletions

1
.github/FUNDING.yml vendored
View file

@ -2,4 +2,3 @@
github: [do1jlr]
liberapay: L3D
custom: ['https://paypal.me/c3woc']

View file

@ -0,0 +1,16 @@
name: Ansible check archlinux:latest
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: ansible check with archlinux:latest
uses: roles-ansible/check-ansible-archlinux-latest-action@master
with:
targets: "./"

View file

@ -0,0 +1,16 @@
name: Ansible check debian:latest
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: ansible check with debian:latest
uses: roles-ansible/check-ansible-debian-latest-action@master
with:
targets: "./"

View file

@ -0,0 +1,16 @@
name: Ansible check ubuntu:bionic
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: ansible check with ubuntu:bionic
uses: roles-ansible/check-ansible-ubuntu-bionic-action@master
with:
targets: "./"

View file

@ -0,0 +1,16 @@
name: Ansible check ubuntu:eoan
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: ansible check with ubuntu:eoan
uses: roles-ansible/check-ansible-ubuntu-eoan-action@master
with:
targets: "./"

View file

@ -0,0 +1,16 @@
name: Ansible check ubuntu:trusty
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: ansible check with ubuntu:trusty
uses: roles-ansible/check-ansible-ubuntu-trusty-action@master
with:
targets: "./"

View file

@ -0,0 +1,16 @@
name: Ansible check ubuntu:xenial
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: ansible check with ubuntu:xenial
uses: roles-ansible/check-ansible-ubuntu-xenial-action@master
with:
targets: "./"

109
README.md
View file

@ -1,51 +1,27 @@
[![ansible-galaxy: do1jlr.akku_warning](https://raw.githubusercontent.com/chaos-bodensee/role_akku_warning/master/.github/galaxy.svg?sanitize=true)](https://galaxy.ansible.com/do1jlr/akku_warning)
[![Ansible Lint check](https://github.com/chaos-bodensee/role_akku_warning/workflows/Ansible%20Lint%20check/badge.svg)](https://github.com/chaos-bodensee/role_akku_warning/actions?query=workflow%3A%22Ansible+Lint+check%22)
[![Build Status](https://travis-ci.org/chaos-bodensee/role_akku_warning.svg?branch=master)](https://travis-ci.org/chaos-bodensee/role_akku_warning)
[![Ansible check debian:stable](https://github.com/chaos-bodensee/role_akku_warning/workflows/Ansible%20check%20debian:stable/badge.svg)](https://github.com/chaos-bodensee/role_akku_warning/actions?query=workflow%3A%22Ansible+check+debian%3Astable%22)
[![Ansible check debian:sid](https://github.com/chaos-bodensee/role_akku_warning/workflows/Ansible%20check%20debian:sid/badge.svg)](https://github.com/chaos-bodensee/role_akku_warning/actions?query=workflow%3A%22Ansible+check+debian%3Asid%22)
[![Ansible check debian:buster](https://github.com/chaos-bodensee/role_akku_warning/workflows/Ansible%20check%20debian:buster/badge.svg)](https://github.com/chaos-bodensee/role_akku_warning/actions?query=workflow%3A%22Ansible+check+debian%3Abuster%22)
[![Ansible check debian:jessie](https://github.com/chaos-bodensee/role_akku_warning/workflows/Ansible%20check%20debian:jessie/badge.svg)](https://github.com/chaos-bodensee/role_akku_warning/actions?query=workflow%3A%22Ansible+check+debian%3Ajessie%22)
[![Ansible check debian:stretch](https://github.com/chaos-bodensee/role_akku_warning/workflows/Ansible%20check%20debian:stretch/badge.svg)](https://github.com/chaos-bodensee/role_akku_warning/actions?query=workflow%3A%22Ansible+check+debian%3Astretch%22)
[![Ansible check ubuntu:latest](https://github.com/chaos-bodensee/role_akku_warning/workflows/Ansible%20check%20ubuntu:latest/badge.svg)](https://github.com/chaos-bodensee/role_akku_warning/actions?query=workflow%3A%22Ansible+check+ubuntu%3Alatest%22)
[![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)
[![Ansible Galaxy](https://raw.githubusercontent.com/roles-ansible/role_akku_warning/master/.github/galaxy.svg?sanitize=true)](https://galaxy.ansible.com/do1jlr/akku_warning) [![Build Status](https://travis-ci.org/roles-ansible/role_akku_warning.svg?branch=master)](https://travis-ci.org/roles-ansible/role_akku_warning) [![MIT License](https://raw.githubusercontent.com/roles-ansible/role_akku_warning/master/.github/license.svg?sanitize=true)](https://github.com/roles-ansible/role_akku_warning/blob/master/LICENSE)
ansible role: akku warning
ansible role: akku warning
==========================
This ansible warning will install an bash Script, that will be executet every 3 minutes.
This ansible role installs a bash script (per cronjob) which is executed every 3 minutes. This bash script checks if the battery level is below 25 percent and is currently not charging. If this is the case, the program [zenity](https://de.wikipedia.org/wiki/Zenity) installed by this role will generate a popup message stating that the battery is low.
While the battery level is between 15 and 10 percent, it will also attempt to play a sound. But this does not (yet) work reliably.
If your batterie is under 25 percent, it will start warning you.
This role is tested with the [i3 - improved tiling wm](https://i3wm.org/), but probably will work on all window magers!
Variables:
-----------
```yaml
# Your username you mostly use on your device
akku_user: "{{ ansible_user_id }}"
# should we install and enable cronie?
install_and_enable_cronie: true
# play a sound at critical battery level
multimedia_akku_warning: true
# set this to false to disable package installation?
manage_packages_akku_warning: true
# version check for this playbook
submodules_versioncheck: true
```
*For a complete view of all variables pleas have a look into the default folder.*
This role is tested with the [i3 - improved tiling wm](https://i3wm.org/), installed by [this role](https://github.com/chaos-bodensee/role-i3wm.git) at Archlinux, but probably will work on all window magers and the most operating systems!
Installation and Usage
------------
------------------------
### install with galaxy:
```bash
ansible-galaxy install do1jlr.akku_warning
```
You can execute the role **directly via ansible ad-hoc commands**, but it is highly recomended to create a ansible playbook
```bash
# example ad-hoc command
ansible -m include_role -a "name=do1jlr.akku_warning" localhost
```
### example playbook with galaxy
```yaml
---
@ -57,7 +33,7 @@ ansible-galaxy install do1jlr.akku_warning
### installation via git
```bash
# download this role into your roles directory
git clone https://github.com/chaos-bodensee/role_akku_warning.git
git clone https://github.com/roles-ansible/role_akku_warning.git
```
### example playbook
@ -71,10 +47,61 @@ git clone https://github.com/chaos-bodensee/role_akku_warning.git
- role_akku_warning
```
Variables:
-----------
```yaml
---
# simple version check for this playbook
# true is highly recomended
submodules_versioncheck: false
# which user are we currently using?
akku_user: "{{ ansible_user_id }}"
# which sound should we play?
akku_sound_src: 'files/low_battery.m4a'
akku_sound_dest: '/opt/low_battery.m4a'
# should we install cronie?
install_and_enable_cronie: true
# play a video in the background with sound
multimedia_akku_warning: true
# you want to install missing packages?
manage_packages_akku_warning: true
```
Missing something?
----------------
Please feel free to open a [github](https://github.com/chaos-bodensee/role_akku_warning.git) Issue or Pull-Request. Thanks <3
Please feel free to open a [github](https://github.com/roles-ansible/role_akku_warning.git) Issue or Pull-Request. Thanks <3
Testing
---------
This role is tested via github [actions](https://github.com/chaos-bodensee/role_akku_warning/actions).
----------
This role is tested with [these github-action](https://github.com/search?q=topic%3Acheck-ansible+topic%3Agithub-actions+org%3Aroles-ansible&type=Repositories) tests for different versions of differen linux systems. Linting is tested via travis-ci and the [ansible-lint action](https://github.com/marketplace/actions/ansible-lint).
If you want to find out more about our tests, please have a look at the github marketplace.
| test status | Github Marketplace |
| :--------- | :---------------- |
| [![Travis Build Status](https://travis-ci.org/roles-ansible/role_akku_warning.svg?branch=master)](https://travis-ci.org/roles-ansible/role_akku_warning) | [.travis.yml](https://github.com/roles-ansible/role_akku_warning/blob/master/.travis.yml) |
|||
| [![Ansible Lint check](https://github.com/roles-ansible/role_akku_warning/workflows/Ansible%20Lint%20check/badge.svg)](https://github.com/roles-ansible/role_akku_warning/actions?query=workflow%3A%22Ansible+Lint+check%22) | [ansible-lint action](https://github.com/marketplace/actions/ansible-lint)
| [![Ansible check debian:stable](https://github.com/roles-ansible/role_akku_warning/workflows/Ansible%20check%20debian:stable/badge.svg)](https://github.com/roles-ansible/role_akku_warning/actions?query=workflow%3A%22Ansible+check+debian%3Astable%22) | [ansible test with debian stable](https://github.com/marketplace/actions/check-ansible-debian-stable) |
| [![Ansible check debian:latest](https://github.com/roles-ansible/role_akku_warning/workflows/Ansible%20check%20debian:latest/badge.svg)](https://github.com/roles-ansible/role_akku_warning/actions?query=workflow%3A%22Ansible+check+debian%3Alatest%22) | [ansible test with debian latest](https://github.com/marketplace/actions/check-ansible-debian-latest) |
| [![Ansible check debian:sid](https://github.com/roles-ansible/role_akku_warning/workflows/Ansible%20check%20debian:sid/badge.svg)](https://github.com/roles-ansible/role_akku_warning/actions?query=workflow%3A%22Ansible+check+debian%3Asid%22) | [ansible test with debian sid](https://github.com/marketplace/actions/check-ansible-debian-sid) |
| [![Ansible check debian:buster](https://github.com/roles-ansible/role_akku_warning/workflows/Ansible%20check%20debian:buster/badge.svg)](https://github.com/roles-ansible/role_akku_warning/actions?query=workflow%3A%22Ansible+check+debian%3Abuster%22) | [ansible test with debian buster](https://github.com/marketplace/actions/check-ansible-debian-buster) |
| [![Ansible check debian:jessie](https://github.com/roles-ansible/role_akku_warning/workflows/Ansible%20check%20debian:jessie/badge.svg)](https://github.com/roles-ansible/role_akku_warning/actions?query=workflow%3A%22Ansible+check+debian%3Ajessie%22) | [ansible test with debian jessie](https://github.com/marketplace/actions/check-ansible-debian-jessie) |
| [![Ansible check debian:stretch](https://github.com/roles-ansible/role_akku_warning/workflows/Ansible%20check%20debian:stretch/badge.svg)](https://github.com/roles-ansible/role_akku_warning/actions?query=workflow%3A%22Ansible+check+debian%3Astretch%22) | [ansible test with debian stretch](https://github.com/marketplace/actions/check-ansible-debian-stretch) |
| | |
| [![Ansible check archlinux:latest](https://github.com/roles-ansible/role_akku_warning/workflows/Ansible%20check%20archlinux:latest/badge.svg)](https://github.com/roles-ansible/role_akku_warning/actions?query=workflow%3A%22Ansible+check+archlinux%3Alatest%22) | [ansible test with archlinux latest](https://github.com/marketplace/actions/check-ansible-archlinux-latest) |
| | |
| [![Ansible check ubuntu:latest](https://github.com/roles-ansible/role_akku_warning/workflows/Ansible%20check%20ubuntu:latest/badge.svg)](https://github.com/roles-ansible/role_akku_warning/actions?query=workflow%3A%22Ansible+check+ubuntu%3Alatest%22) | [ansible test with ubuntu latest](https://github.com/marketplace/actions/check-ansible-ubuntu-latest) |
| [![Ansible check ubuntu:bionic](https://github.com/roles-ansible/role_akku_warning/workflows/Ansible%20check%20ubuntu:bionic/badge.svg)](https://github.com/roles-ansible/role_akku_warning/actions?query=workflow%3A%22Ansible+check+ubuntu%3Abionic%22) | [ansible test with ubuntu bionic](https://github.com/marketplace/actions/check-ansible-ubuntu-bionic) |
| [![Ansible check ubuntu:eoan](https://github.com/roles-ansible/role_akku_warning/workflows/Ansible%20check%20ubuntu:eoan/badge.svg)](https://github.com/roles-ansible/role_akku_warning/actions?query=workflow%3A%22Ansible+check+ubuntu%3Aeoan%22) | [ansible test with ubuntu eoan](https://github.com/marketplace/actions/check-ansible-ubuntu-eoan) |
| [![Ansible check ubuntu:trusty](https://github.com/roles-ansible/role_akku_warning/workflows/Ansible%20check%20ubuntu:trusty/badge.svg)](https://github.com/roles-ansible/role_akku_warning/actions?query=workflow%3A%22Ansible+check+ubuntu%3Atrusty%22) | [ansible test with ubuntu trusty](https://github.com/marketplace/actions/check-ansible-ubuntu-trusty) |
| [![Ansible check ubuntu:xenial](https://github.com/roles-ansible/role_akku_warning/workflows/Ansible%20check%20ubuntu:xenial/badge.svg)](https://github.com/roles-ansible/role_akku_warning/actions?query=workflow%3A%22Ansible+check+ubuntu%3Axenial%22) | [ansible test with ubuntu xenial](https://github.com/marketplace/actions/check-ansible-ubuntu-xenial) |
Contribution
------------
If you are missing some features or have an idea for improving this role, please feel free to open an issue - or even better - create a pull request.

View file

@ -1,4 +1,8 @@
---
# simple version check for this playbook
# true is highly recomended
submodules_versioncheck: false
# which user are we currently using?
akku_user: "{{ ansible_user_id }}"
@ -14,6 +18,3 @@ multimedia_akku_warning: true
# you want to install missing packages?
manage_packages_akku_warning: true
# version check for this playbook
submodules_versioncheck: true

View file

@ -11,13 +11,16 @@ galaxy_info:
versions: all
- name: Debian
versions:
- all
- sid
- buster
- jessie
- stretch
- name: Ubuntu
versions:
- all
- name: Fedora
versions:
- all
- xenial
- trusty
- eoan
- bionic
galaxy_tags:
- akku
- warning

View file

@ -2,7 +2,7 @@
- name: copy sound warning script
become: yes
template:
src: 'templates/akku.sh'
src: 'templates/akku.sh.j2'
dest: '/opt/akku.sh'
owner: 'root'
group: 'root'

View file

@ -23,7 +23,7 @@
- manage_packages_akku_warning | bool
- install_and_enable_cronie | bool
- name: Check akku every 2 minutes
- name: Check akku every 3 minutes
become: yes
cron:
name: check if akku still okay