mirror of
https://github.com/roles-ansible/role_akku_warning.git
synced 2024-08-16 10:09:50 +02:00
Update, lint and improve role
This commit is contained in:
parent
1c12737595
commit
e1136e1227
12 changed files with 127 additions and 91 deletions
9
.github/dependabot.yml
vendored
Normal file
9
.github/dependabot.yml
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
---
|
||||||
|
# See https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
|
||||||
|
- package-ecosystem: "github-actions"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
26
.github/workflows/ansible-linting-check.yml
vendored
26
.github/workflows/ansible-linting-check.yml
vendored
|
@ -2,25 +2,21 @@
|
||||||
name: Ansible Lint check
|
name: Ansible Lint check
|
||||||
|
|
||||||
# yamllint disable-line rule:truthy
|
# yamllint disable-line rule:truthy
|
||||||
on:
|
on: [push, pull_request]
|
||||||
push:
|
|
||||||
branches: '*'
|
|
||||||
pull_request:
|
|
||||||
branches: '*'
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
name: Ansible Lint
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- name: Checkout git repo
|
||||||
|
uses: actions/checkout@v4
|
||||||
- name: Lint Ansible Playbook
|
|
||||||
uses: ansible/ansible-lint-action@master
|
|
||||||
with:
|
with:
|
||||||
targets: "."
|
submodules: true
|
||||||
# [required]
|
fetch-depth: 0
|
||||||
# Paths to ansible files (i.e., playbooks, tasks, handlers etc..)
|
|
||||||
args: ""
|
- name: Run ansible-lint
|
||||||
# [optional]
|
uses: ansible-actions/ansible-lint-action@v1.0.2
|
||||||
|
with:
|
||||||
|
target: "./"
|
||||||
|
|
18
.github/workflows/galaxy.yml
vendored
18
.github/workflows/galaxy.yml
vendored
|
@ -1,20 +1,24 @@
|
||||||
---
|
---
|
||||||
name: Galaxy release
|
name: Galaxy-NG Roles Import
|
||||||
|
|
||||||
# yamllint disable-line rule:truthy
|
# yamllint disable-line rule:truthy
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
branches: ['main']
|
|
||||||
release:
|
release:
|
||||||
types: ['created']
|
types: ['created']
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
name: Galaxy Role Importer
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: 'Checkout git repo'
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
- name: galaxy
|
with:
|
||||||
uses: robertdebock/galaxy-action@1.1.0
|
submodules: true
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: 'Release on galaxy'
|
||||||
|
uses: ansible-actions/ansible-galaxy-action@v1.1.1
|
||||||
with:
|
with:
|
||||||
galaxy_api_key: ${{ secrets.galaxy_api_key }}
|
galaxy_api_key: ${{ secrets.galaxy_api_key }}
|
||||||
|
|
22
.github/workflows/j2lint-check.yml
vendored
Normal file
22
.github/workflows/j2lint-check.yml
vendored
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
---
|
||||||
|
name: Jinja2 Linting check
|
||||||
|
|
||||||
|
# yamllint disable-line rule:truthy
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Jinja2 Linting
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout git repo
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: true
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Run j2lint
|
||||||
|
uses: ansible-actions/j2lint-action@v0.0.1
|
||||||
|
with:
|
||||||
|
target: "./"
|
22
.github/workflows/yamllint-check.yml
vendored
Normal file
22
.github/workflows/yamllint-check.yml
vendored
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
---
|
||||||
|
name: Yamllint check
|
||||||
|
|
||||||
|
# yamllint disable-line rule:truthy
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Yamllint
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout git repo
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: true
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Run yamllint
|
||||||
|
uses: ansible-actions/yamllint-action@v0.0.1
|
||||||
|
with:
|
||||||
|
target: "./"
|
22
.github/workflows/yamllint.yaml
vendored
22
.github/workflows/yamllint.yaml
vendored
|
@ -1,22 +0,0 @@
|
||||||
---
|
|
||||||
name: 'Yamllint GitHub Actions'
|
|
||||||
|
|
||||||
# yamllint disable-line rule:truthy
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: '*'
|
|
||||||
pull_request:
|
|
||||||
branches: '*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
yamllint:
|
|
||||||
name: 'Yamllint'
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: 'Checkout'
|
|
||||||
uses: actions/checkout@master
|
|
||||||
- name: 'Yamllint'
|
|
||||||
uses: karancode/yamllint-github-action@master
|
|
||||||
with:
|
|
||||||
yamllint_file_or_dir: '.'
|
|
||||||
yamllint_config_filepath: './.yamllint'
|
|
|
@ -1,16 +1,16 @@
|
||||||
---
|
---
|
||||||
- name: systemctl daemon-reload
|
- name: Run systemctl daemon-reload
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
daemon_reload: true
|
daemon_reload: true
|
||||||
|
|
||||||
- name: systemctl start battery_check.service
|
- name: Run systemctl start battery_check.service
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
name: 'battery_check.service'
|
name: 'battery_check.service'
|
||||||
state: started
|
state: started
|
||||||
|
|
||||||
- name: systemctl enable battery_check.timer
|
- name: Run systemctl enable battery_check.timer
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
name: 'battery_check.timer'
|
name: 'battery_check.timer'
|
||||||
|
|
|
@ -3,16 +3,16 @@ galaxy_info:
|
||||||
author: do1jlr
|
author: do1jlr
|
||||||
description: Get a popup if the akku is getting low, get a warning sound, if the akku is even lower.
|
description: Get a popup if the akku is getting low, get a warning sound, if the akku is even lower.
|
||||||
role_name: akku_warning
|
role_name: akku_warning
|
||||||
|
namespace: l3d
|
||||||
license: MIT
|
license: MIT
|
||||||
min_ansible_version: 2.11
|
min_ansible_version: "2.13"
|
||||||
github_branch: master
|
|
||||||
platforms:
|
platforms:
|
||||||
- name: Archlinux
|
- name: ArchLinux
|
||||||
versions: all
|
versions: ['all']
|
||||||
- name: Debian
|
- name: Debian
|
||||||
versions: all
|
versions: ['all']
|
||||||
- name: Ubuntu
|
- name: Ubuntu
|
||||||
versions: all
|
versions: ['all']
|
||||||
galaxy_tags:
|
galaxy_tags:
|
||||||
- akku
|
- akku
|
||||||
- warning
|
- warning
|
||||||
|
@ -21,4 +21,5 @@ galaxy_info:
|
||||||
- arch
|
- arch
|
||||||
- desktop
|
- desktop
|
||||||
- batterie
|
- batterie
|
||||||
|
- linux
|
||||||
dependencies: []
|
dependencies: []
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
- name: copy sound warning script
|
- name: Copy sound warning script
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: 'templates/akku.sh.j2'
|
src: 'templates/akku.sh.j2'
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
group: 'root'
|
group: 'root'
|
||||||
mode: '0755'
|
mode: '0755'
|
||||||
|
|
||||||
- name: copy sound warning video
|
- name: Copy sound warning video
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
src: "{{ akku_sound_src }}"
|
src: "{{ akku_sound_src }}"
|
||||||
|
|
|
@ -1,19 +1,23 @@
|
||||||
---
|
---
|
||||||
- name: run optional versionscheck
|
- name: Run optional versionscheck
|
||||||
ansible.builtin.include_tasks: versioncheck.yml
|
ansible.builtin.include_tasks:
|
||||||
|
file: 'versioncheck.yml'
|
||||||
when: submodules_versioncheck|bool
|
when: submodules_versioncheck|bool
|
||||||
|
|
||||||
- name: copy media files
|
- name: Copy media files
|
||||||
ansible.builtin.include_tasks: copy_media_files.yml
|
ansible.builtin.include_tasks:
|
||||||
|
file: 'copy_media_files.yml'
|
||||||
|
|
||||||
- name: install zenity and mpv for notifications
|
- name: Install zenity and mpv for notifications
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.package:
|
ansible.builtin.package:
|
||||||
name:
|
name: "{{ item }}"
|
||||||
- zenity
|
state: 'present'
|
||||||
- mpv
|
loop:
|
||||||
state: present
|
- 'zenity'
|
||||||
|
- 'mpv'
|
||||||
when: manage_packages_akku_warning | bool
|
when: manage_packages_akku_warning | bool
|
||||||
|
|
||||||
- name: set timer
|
- name: Set timer
|
||||||
ansible.builtin.include_tasks: timer.yml
|
ansible.builtin.include_tasks:
|
||||||
|
file: 'timer.yml'
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
---
|
---
|
||||||
- name: setup battery_check.service
|
- name: Setup battery_check.service
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: 'templates/battery_check.service.j2'
|
src: 'templates/battery_check.service.j2'
|
||||||
dest: '/usr/lib/systemd/system/battery_check.service'
|
dest: '/usr/lib/systemd/system/battery_check.service'
|
||||||
mode: 0755
|
mode: '0755'
|
||||||
owner: root
|
owner: 'root'
|
||||||
group: root
|
group: 'root'
|
||||||
notify:
|
notify:
|
||||||
- systemctl daemon-reload
|
- 'Run systemctl daemon-reload'
|
||||||
- systemctl start battery_check.service
|
- 'Run systemctl start battery_check.service'
|
||||||
|
|
||||||
- name: setup battery_check.timer
|
- name: Setup battery_check.timer
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: 'templates/battery_check.timer.j2'
|
src: 'templates/battery_check.timer.j2'
|
||||||
dest: '/usr/lib/systemd/system/battery_check.timer'
|
dest: '/usr/lib/systemd/system/battery_check.timer'
|
||||||
mode: 0755
|
mode: '0755'
|
||||||
owner: root
|
owner: 'root'
|
||||||
group: root
|
group: 'root'
|
||||||
notify:
|
notify:
|
||||||
- systemctl daemon-reload
|
- 'Run systemctl daemon-reload'
|
||||||
- systemctl enable battery_check.timer
|
- 'Run systemctl enable battery_check.timer'
|
||||||
|
|
|
@ -7,38 +7,38 @@
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: '/etc/.ansible-version'
|
path: '/etc/.ansible-version'
|
||||||
state: directory
|
state: directory
|
||||||
mode: 0755
|
mode: '0755'
|
||||||
when: submodules_versioncheck|bool
|
when: submodules_versioncheck | bool
|
||||||
|
|
||||||
- name: check playbook version
|
- name: Check playbook version
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.slurp:
|
ansible.builtin.slurp:
|
||||||
src: "/etc/.ansible-version/{{ playbook_version_path }}"
|
src: "/etc/.ansible-version/{{ playbook_version_path }}"
|
||||||
register: playbook_version
|
register: playbook_version
|
||||||
when: submodules_versioncheck|bool
|
when: submodules_versioncheck | bool
|
||||||
ignore_errors: true
|
|
||||||
failed_when: false
|
failed_when: false
|
||||||
|
|
||||||
- name: Print remote role version
|
- name: Print remote role version # noqa: H500
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: "Remote role version: {{ playbook_version.content | default('Y3VycmVudGx5IG5vdCBkZXBsb3llZAo=') | b64decode | string }}"
|
msg: "Remote role version: {{ playbook_version.content | default('Y3VycmVudGx5IG5vdCBkZXBsb3llZAo=') | b64decode | string }}"
|
||||||
when: submodules_versioncheck|bool
|
when: submodules_versioncheck | bool
|
||||||
|
|
||||||
- name: Print locale role version
|
- name: Print locale role version # noqa: H500
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: "Local role version: '{{ playbook_version_number|string }}'."
|
msg: "Local role version: '{{ playbook_version_number | string }}'."
|
||||||
when: submodules_versioncheck|bool
|
when: submodules_versioncheck | bool
|
||||||
|
|
||||||
- name: Check if your version is outdated
|
- name: Check if your version is outdated
|
||||||
ansible.builtin.fail:
|
ansible.builtin.fail:
|
||||||
msg: "Your ansible module has the version '{{ playbook_version_number }}' and is outdated. You need to update it!"
|
msg: "Your ansible module has the version '{{ playbook_version_number }}' and is outdated. You need to update it!"
|
||||||
when:
|
when:
|
||||||
- playbook_version.content|default("Mgo=")|b64decode|int - 1 >= playbook_version_number|int and submodules_versioncheck|bool
|
- playbook_version.content|default("Mgo=")|b64decode|int - 1 >= playbook_version_number|int and submodules_versioncheck | bool
|
||||||
|
|
||||||
- name: write new version to remote disk
|
- name: Write new version to remote disk
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
content: "{{ playbook_version_number }}"
|
content: "{{ playbook_version_number }}"
|
||||||
dest: "/etc/.ansible-version/{{ playbook_version_path }}"
|
dest: "/etc/.ansible-version/{{ playbook_version_path }}"
|
||||||
mode: '0644'
|
mode: '0644'
|
||||||
when: submodules_versioncheck|bool
|
when: submodules_versioncheck | bool
|
||||||
|
tags: skip_ansible_lint_template-instead-of-copy
|
||||||
|
|
Loading…
Reference in a new issue