1
0
Fork 0
mirror of https://github.com/roles-ansible/role_akku_warning.git synced 2024-06-25 20:26:01 +02:00

Fixing linting

This commit is contained in:
L3D 2021-11-11 21:20:47 +01:00
parent a1e2982b3d
commit 49a16adaa5
Signed by: l3d
GPG key ID: CD08445BFF4313D1
32 changed files with 310 additions and 174 deletions

1
.github/FUNDING.yml vendored
View file

@ -1,3 +1,4 @@
---
# These are supported funding model platforms
github: [do1jlr]

View file

@ -0,0 +1,18 @@
---
name: Ansible check alpine:latest
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: ansible check with alpine:latest
uses: roles-ansible/check-ansible-alpine-latest-action@master
with:
targets: "./"

View file

@ -1,5 +1,7 @@
---
name: Ansible check archlinux:latest
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
@ -8,9 +10,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
- name: ansible check with archlinux:latest
uses: roles-ansible/check-ansible-archlinux-latest-action@master
with:
targets: "./"
- name: ansible check with archlinux:latest
uses: roles-ansible/check-ansible-archlinux-latest-action@master
with:
targets: "./"

View file

@ -0,0 +1,18 @@
---
name: Ansible check centos:centos7
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: ansible check with ubuntu:centos7
uses: roles-ansible/check-ansible-centos-centos7-action@master
with:
targets: "./"

View file

@ -0,0 +1,18 @@
---
name: Ansible check centos:centos8
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: ansible check with ubuntu:centos8
uses: roles-ansible/check-ansible-centos-centos8-action@master
with:
targets: "./"

View file

@ -0,0 +1,18 @@
---
name: Ansible check centos:latest
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: ansible check with ubuntu:latest
uses: roles-ansible/check-ansible-centos-latest-action@master
with:
targets: "./"

View file

@ -1,5 +1,7 @@
---
name: Ansible check debian:buster
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
@ -8,9 +10,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
- name: ansible check with debian:buster
uses: roles-ansible/check-ansible-debian-buster-action@master
with:
targets: "./"
- name: ansible check with debian:buster
uses: roles-ansible/check-ansible-debian-buster-action@master
with:
targets: "./"

View file

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

View file

@ -1,5 +1,7 @@
---
name: Ansible check debian:latest
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
@ -8,9 +10,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
- name: ansible check with debian:latest
uses: roles-ansible/check-ansible-debian-latest-action@master
with:
targets: "./"
- name: ansible check with debian:latest
uses: roles-ansible/check-ansible-debian-latest-action@master
with:
targets: "./"

View file

@ -1,5 +1,7 @@
---
name: Ansible check debian:sid
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
@ -8,9 +10,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
- name: ansible check with debian:sid
uses: roles-ansible/check-ansible-debian-sid-action@master
with:
targets: "./"
- name: ansible check with debian:sid
uses: roles-ansible/check-ansible-debian-sid-action@master
with:
targets: "./"

View file

@ -1,6 +1,12 @@
---
name: Ansible check debian:stable
on: [push, pull_request]
# yamllint disable-line rule:truthy
on:
push:
branches: '*'
pull_request:
branches: '*'
jobs:
build:
@ -8,9 +14,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
- name: ansible check with debian:stable
uses: roles-ansible/check-ansible-debian-stable-action@master
with:
targets: "./"
- name: ansible check with debian:stable
uses: roles-ansible/check-ansible-debian-stable-action@master
with:
targets: "./"

View file

@ -1,5 +1,7 @@
---
name: Ansible check debian:stretch
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
@ -8,9 +10,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
- name: ansible check with debian:stretch
uses: roles-ansible/check-ansible-debian-stretch-action@master
with:
targets: "./"
- name: ansible check with debian:stretch
uses: roles-ansible/check-ansible-debian-stretch-action@master
with:
targets: "./"

18
.github/workflows/ansible-fedora-31.yml vendored Normal file
View file

@ -0,0 +1,18 @@
---
name: Ansible check fedora:31
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: ansible check with fedora:31
uses: roles-ansible/check-ansible-fedora-31-action@master
with:
targets: "./"

18
.github/workflows/ansible-fedora-32.yml vendored Normal file
View file

@ -0,0 +1,18 @@
---
name: Ansible check fedora:32
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: ansible check with fedora:32
uses: roles-ansible/check-ansible-fedora-32-action@master
with:
targets: "./"

18
.github/workflows/ansible-fedora-33.yml vendored Normal file
View file

@ -0,0 +1,18 @@
---
name: Ansible check fedora:33
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: ansible check with fedora:33
uses: roles-ansible/check-ansible-fedora-33-action@master
with:
targets: "./"

View file

@ -0,0 +1,18 @@
---
name: Ansible check fedora:latest
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: ansible check with fedora:latest
uses: roles-ansible/check-ansible-fedora-latest-action@master
with:
targets: "./"

View file

@ -0,0 +1,26 @@
---
name: Ansible Lint check
# yamllint disable-line rule:truthy
on:
push:
branches: '*'
pull_request:
branches: '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Lint Ansible Playbook
uses: ansible/ansible-lint-action@master
with:
targets: "."
# [required]
# Paths to ansible files (i.e., playbooks, tasks, handlers etc..)
args: ""
# [optional]

View file

@ -1,20 +0,0 @@
name: Ansible Lint check
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Lint Ansible Playbook
uses: ansible/ansible-lint-action@master
with:
targets: "."
# [required]
# Paths to ansible files (i.e., playbooks, tasks, handlers etc..)
args: ""
# [optional]

View file

@ -1,5 +1,7 @@
---
name: Ansible check ubuntu:bionic
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
@ -8,9 +10,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
- name: ansible check with ubuntu:bionic
uses: roles-ansible/check-ansible-ubuntu-bionic-action@master
with:
targets: "./"
- name: ansible check with ubuntu:bionic
uses: roles-ansible/check-ansible-ubuntu-bionic-action@master
with:
targets: "./"

View file

@ -1,16 +0,0 @@
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

@ -1,5 +1,7 @@
---
name: Ansible check ubuntu:latest
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
@ -8,9 +10,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
- name: ansible check with ubuntu:latest
uses: roles-ansible/check-ansible-ubuntu-latest-action@master
with:
targets: "./"
- name: ansible check with ubuntu:latest
uses: roles-ansible/check-ansible-ubuntu-latest-action@master
with:
targets: "./"

View file

@ -1,5 +1,7 @@
---
name: Ansible check ubuntu:trusty
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
@ -8,9 +10,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
- name: ansible check with ubuntu:trusty
uses: roles-ansible/check-ansible-ubuntu-trusty-action@master
with:
targets: "./"
- name: ansible check with ubuntu:trusty
uses: roles-ansible/check-ansible-ubuntu-trusty-action@master
with:
targets: "./"

View file

@ -1,16 +0,0 @@
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: "./"

20
.github/workflows/galaxy.yml vendored Normal file
View file

@ -0,0 +1,20 @@
---
name: Galaxy release
# yamllint disable-line rule:truthy
on:
push:
branches: ['main']
release:
types: ['created']
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: galaxy
uses: robertdebock/galaxy-action@1.1.0
with:
galaxy_api_key: ${{ secrets.galaxy_api_key }}

22
.github/workflows/yamllint.yaml vendored Normal file
View file

@ -0,0 +1,22 @@
---
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'

View file

@ -1,29 +0,0 @@
---
# OS Details
os: linux
language: python
python: '3.8'
cache:
pip: true
# Install ansible and ansible-lint
install:
- pip install ansible
- pip install ansible-lint
# testing galaxy install and ansible lint
# more advanced testing is currently handled with
# github actions. The gh-actions for our test are there:
# https://github.com/roles-ansible and are tagged
# with 'github-actions' --> https://github.com/search?q=topic%3Agithub-actions+org%3Aroles-ansible&type=Repositories
script:
- ansible-galaxy install do1jlr.ranger
- ansible-lint .
- echo -e "\n\n\n\n\nWe use github actions for more detailed tests.\n\nMore details about that in our github repo at:\nhttps://github.com/chaos-bodensee/role_akku_warning/actions\n\n\n\n\n\n"
notifications:
email:
on_success: never
on_failure: always
webhooks: https://galaxy.ansible.com/api/v1/notifications/

8
.yamllint Normal file
View file

@ -0,0 +1,8 @@
---
extends: default
rules:
# 160 chars should be enough, but don't fail if a line is longer
line-length:
max: 160
level: warning

View file

@ -1,26 +1,18 @@
---
galaxy_info:
author: L3D
author: do1jlr
description: Get a popup if the akku is getting low, get a warning sound, if the akku is even lower.
role_name: akku_warning
license: MIT
min_ansible_version: 2.3
min_ansible_version: 2.11
github_branch: master
platforms:
- name: Archlinux
versions: all
- name: Debian
versions:
- sid
- buster
- jessie
- stretch
versions: all
- name: Ubuntu
versions:
- xenial
- trusty
- eoan
- bionic
versions: all
galaxy_tags:
- akku
- warning

View file

@ -1,6 +1,6 @@
---
- name: copy sound warning script
become: yes
become: true
template:
src: 'templates/akku.sh.j2'
dest: '/opt/akku.sh'
@ -9,7 +9,7 @@
mode: '0755'
- name: copy sound warning video
become: yes
become: true
copy:
src: "{{ akku_sound_src }}"
dest: "{{ akku_sound_dest }}"

View file

@ -5,7 +5,7 @@
- include_tasks: copy_media_files.yml
- name: install zenity and mpv for notifications
become: yes
become: true
package:
name:
- zenity
@ -24,7 +24,7 @@
- install_and_enable_cronie | bool
- name: Check akku every 3 minutes
become: yes
become: true
cron:
name: check if akku still okay
job: /opt/akku.sh

View file

@ -1,7 +1,10 @@
---
# Copyright (c) 2021 L3D <l3d@c3woc.de>
# this file is released with the MIT license.
# License: https://github.com/roles-ansible/ansible_role_template/blob/main/LICENSE
- name: Create directory for versionscheck
become: true
file:
ansible.builtin.file:
path: '/etc/.ansible-version'
state: directory
mode: 0755
@ -9,38 +12,33 @@
- name: check playbook version
become: true
slurp:
ansible.builtin.slurp:
src: "/etc/.ansible-version/{{ playbook_version_path }}"
register: playbook_version
when: submodules_versioncheck|bool
ignore_errors: yes
ignore_errors: true
failed_when: false
- name: Print remote role version
debug:
ansible.builtin.debug:
msg: "Remote role version: {{ playbook_version.content | default('Y3VycmVudGx5IG5vdCBkZXBsb3llZAo=') | b64decode | string }}"
when: submodules_versioncheck|bool
- name: Print locale role version
debug:
ansible.builtin.debug:
msg: "Local role version: '{{ playbook_version_number|string }}'."
when: submodules_versioncheck|bool
- name: Check if your version is outdated
fail:
ansible.builtin.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: check if '/etc/ansible-version/' is empty
find:
paths: '/etc/ansible-version/'
register: filesFound
- name: write new version to remote disk
become: true
copy:
ansible.builtin.copy:
content: "{{ playbook_version_number }}"
dest: "/etc/.ansible-version/{{ playbook_version_path }}"
mode: 0644
mode: '0644'
when: submodules_versioncheck|bool

View file

@ -1,3 +1,3 @@
---
playbook_version_number: 8172 #should be over ninethousand
playbook_version_path: 'role-akku-warning_chaos-bodensee_github.com.version'
playbook_version_number: 8175
playbook_version_path: 'role-akku-warning_chaos-bodensee_github.com.version'