From 03e6fa26af6278edcd249f7f793f12ed8631f769 Mon Sep 17 00:00:00 2001 From: L3D Date: Mon, 21 Nov 2022 14:58:47 +0100 Subject: [PATCH] Initial commit --- .github/.galaxy.yml | 20 + .github/FUNDING.yml | 6 + .github/galaxy.svg | 522 ++++++++++++++++++ .github/license.svg | 217 ++++++++ .../workflows/ansible-archlinux-latest.yml | 18 + .github/workflows/ansible-centos-centos7.yml | 18 + .github/workflows/ansible-centos-centos8.yml | 18 + .github/workflows/ansible-centos-latest.yml | 18 + .github/workflows/ansible-debian-bullseye.yml | 18 + .github/workflows/ansible-debian-buster.yml | 18 + .github/workflows/ansible-debian-latest.yml | 18 + .github/workflows/ansible-debian-sid.yml | 18 + .github/workflows/ansible-debian-stable.yml | 18 + .github/workflows/ansible-debian-stretch.yml | 18 + .github/workflows/ansible-fedora-32.yml | 18 + .github/workflows/ansible-fedora-33.yml | 18 + .github/workflows/ansible-fedora-latest.yml | 18 + .github/workflows/ansible-linting-check.yml | 23 + .github/workflows/ansible-ubuntu-latest.yml | 18 + .github/workflows/galaxy.yml | 22 + .github/workflows/yamllint.yaml | 23 + .gitignore | 2 + .yamllint | 8 + LICENSE | 21 + README.md | 2 + defaults/main.yml | 3 + tasks/main.yml | 4 + tasks/versioncheck.yml | 45 ++ vars/main.yml | 4 + 29 files changed, 1174 insertions(+) create mode 100644 .github/.galaxy.yml create mode 100644 .github/FUNDING.yml create mode 100644 .github/galaxy.svg create mode 100644 .github/license.svg create mode 100644 .github/workflows/ansible-archlinux-latest.yml create mode 100644 .github/workflows/ansible-centos-centos7.yml create mode 100644 .github/workflows/ansible-centos-centos8.yml create mode 100644 .github/workflows/ansible-centos-latest.yml create mode 100644 .github/workflows/ansible-debian-bullseye.yml create mode 100644 .github/workflows/ansible-debian-buster.yml create mode 100644 .github/workflows/ansible-debian-latest.yml create mode 100644 .github/workflows/ansible-debian-sid.yml create mode 100644 .github/workflows/ansible-debian-stable.yml create mode 100644 .github/workflows/ansible-debian-stretch.yml create mode 100644 .github/workflows/ansible-fedora-32.yml create mode 100644 .github/workflows/ansible-fedora-33.yml create mode 100644 .github/workflows/ansible-fedora-latest.yml create mode 100644 .github/workflows/ansible-linting-check.yml create mode 100644 .github/workflows/ansible-ubuntu-latest.yml create mode 100644 .github/workflows/galaxy.yml create mode 100644 .github/workflows/yamllint.yaml create mode 100644 .gitignore create mode 100644 .yamllint create mode 100644 LICENSE create mode 100644 README.md create mode 100644 defaults/main.yml create mode 100644 tasks/main.yml create mode 100644 tasks/versioncheck.yml create mode 100644 vars/main.yml diff --git a/.github/.galaxy.yml b/.github/.galaxy.yml new file mode 100644 index 0000000..b5dc0ec --- /dev/null +++ b/.github/.galaxy.yml @@ -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 }} diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..8f96dfd --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,6 @@ +--- +# Feel free to add yourself if you maintain this repo +# or participate in a way that you have the feeling that you belong there ;-) + +github: [do1jlr] +liberapay: L3D diff --git a/.github/galaxy.svg b/.github/galaxy.svg new file mode 100644 index 0000000..bdc8e04 --- /dev/null +++ b/.github/galaxy.svg @@ -0,0 +1,522 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.github/license.svg b/.github/license.svg new file mode 100644 index 0000000..4ab6d9a --- /dev/null +++ b/.github/license.svg @@ -0,0 +1,217 @@ + + + + + + image/svg+xml + + + + + + 3D <l3d@c3woc.de> + + + + + MIT License + + + + + + + + + + + + + + + + + + + + + + + + + + + MIT + MIT + + + license + license + + diff --git a/.github/workflows/ansible-archlinux-latest.yml b/.github/workflows/ansible-archlinux-latest.yml new file mode 100644 index 0000000..e823f0c --- /dev/null +++ b/.github/workflows/ansible-archlinux-latest.yml @@ -0,0 +1,18 @@ +--- +name: Ansible check archlinux: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 archlinux:latest + uses: roles-ansible/check-ansible-archlinux-latest-action@master + with: + targets: "./" diff --git a/.github/workflows/ansible-centos-centos7.yml b/.github/workflows/ansible-centos-centos7.yml new file mode 100644 index 0000000..401d2c0 --- /dev/null +++ b/.github/workflows/ansible-centos-centos7.yml @@ -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: "./" diff --git a/.github/workflows/ansible-centos-centos8.yml b/.github/workflows/ansible-centos-centos8.yml new file mode 100644 index 0000000..f20097b --- /dev/null +++ b/.github/workflows/ansible-centos-centos8.yml @@ -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: "./" diff --git a/.github/workflows/ansible-centos-latest.yml b/.github/workflows/ansible-centos-latest.yml new file mode 100644 index 0000000..94eb54b --- /dev/null +++ b/.github/workflows/ansible-centos-latest.yml @@ -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: "./" diff --git a/.github/workflows/ansible-debian-bullseye.yml b/.github/workflows/ansible-debian-bullseye.yml new file mode 100644 index 0000000..4b7c45d --- /dev/null +++ b/.github/workflows/ansible-debian-bullseye.yml @@ -0,0 +1,18 @@ +--- +name: Ansible check debian:bullseye + +# yamllint disable-line rule:truthy +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: ansible check with debian:bullseye + uses: roles-ansible/check-ansible-debian-bullseye-action@main + with: + targets: "./" diff --git a/.github/workflows/ansible-debian-buster.yml b/.github/workflows/ansible-debian-buster.yml new file mode 100644 index 0000000..d76b02c --- /dev/null +++ b/.github/workflows/ansible-debian-buster.yml @@ -0,0 +1,18 @@ +--- +name: Ansible check debian:buster + +# yamllint disable-line rule:truthy +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: ansible check with debian:buster + uses: roles-ansible/check-ansible-debian-buster-action@master + with: + targets: "./" diff --git a/.github/workflows/ansible-debian-latest.yml b/.github/workflows/ansible-debian-latest.yml new file mode 100644 index 0000000..f7eb5b6 --- /dev/null +++ b/.github/workflows/ansible-debian-latest.yml @@ -0,0 +1,18 @@ +--- +name: Ansible check debian: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 debian:latest + uses: roles-ansible/check-ansible-debian-latest-action@master + with: + targets: "./" diff --git a/.github/workflows/ansible-debian-sid.yml b/.github/workflows/ansible-debian-sid.yml new file mode 100644 index 0000000..2e3215a --- /dev/null +++ b/.github/workflows/ansible-debian-sid.yml @@ -0,0 +1,18 @@ +--- +name: Ansible check debian:sid + +# yamllint disable-line rule:truthy +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: ansible check with debian:sid + uses: roles-ansible/check-ansible-debian-sid-action@master + with: + targets: "./" diff --git a/.github/workflows/ansible-debian-stable.yml b/.github/workflows/ansible-debian-stable.yml new file mode 100644 index 0000000..e47f773 --- /dev/null +++ b/.github/workflows/ansible-debian-stable.yml @@ -0,0 +1,18 @@ +--- +name: Ansible check debian:stable + +# yamllint disable-line rule:truthy +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: ansible check with debian:stable + uses: roles-ansible/check-ansible-debian-stable-action@master + with: + targets: "./" diff --git a/.github/workflows/ansible-debian-stretch.yml b/.github/workflows/ansible-debian-stretch.yml new file mode 100644 index 0000000..c947cae --- /dev/null +++ b/.github/workflows/ansible-debian-stretch.yml @@ -0,0 +1,18 @@ +--- +name: Ansible check debian:stretch + +# yamllint disable-line rule:truthy +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: ansible check with debian:stretch + uses: roles-ansible/check-ansible-debian-stretch-action@master + with: + targets: "./" diff --git a/.github/workflows/ansible-fedora-32.yml b/.github/workflows/ansible-fedora-32.yml new file mode 100644 index 0000000..e362dd4 --- /dev/null +++ b/.github/workflows/ansible-fedora-32.yml @@ -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: "./" diff --git a/.github/workflows/ansible-fedora-33.yml b/.github/workflows/ansible-fedora-33.yml new file mode 100644 index 0000000..70c52ad --- /dev/null +++ b/.github/workflows/ansible-fedora-33.yml @@ -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: "./" diff --git a/.github/workflows/ansible-fedora-latest.yml b/.github/workflows/ansible-fedora-latest.yml new file mode 100644 index 0000000..7cfbdf7 --- /dev/null +++ b/.github/workflows/ansible-fedora-latest.yml @@ -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: "./" diff --git a/.github/workflows/ansible-linting-check.yml b/.github/workflows/ansible-linting-check.yml new file mode 100644 index 0000000..150e908 --- /dev/null +++ b/.github/workflows/ansible-linting-check.yml @@ -0,0 +1,23 @@ +--- +name: Ansible Lint check + +# yamllint disable-line rule:truthy +on: + push: + branches: '*' + pull_request: + branches: '*' + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - name: 'checkout git repo' + uses: actions/checkout@v3 + + - name: 'Lint Ansible Playbook' + uses: ansible/ansible-lint-action@v6 + with: + targets: "." diff --git a/.github/workflows/ansible-ubuntu-latest.yml b/.github/workflows/ansible-ubuntu-latest.yml new file mode 100644 index 0000000..b9544a5 --- /dev/null +++ b/.github/workflows/ansible-ubuntu-latest.yml @@ -0,0 +1,18 @@ +--- +name: Ansible check ubuntu: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-ubuntu-latest-action@master + with: + targets: "./" diff --git a/.github/workflows/galaxy.yml b/.github/workflows/galaxy.yml new file mode 100644 index 0000000..adcecbd --- /dev/null +++ b/.github/workflows/galaxy.yml @@ -0,0 +1,22 @@ +--- +name: Galaxy release + +# yamllint disable-line rule:truthy +on: + push: + branches: ['main'] + release: + types: ['created'] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: 'checkout git repo' + uses: actions/checkout@v3 + + - name: 'release on galaxy' + uses: robertdebock/galaxy-action@1.2.0 + with: + galaxy_api_key: ${{ secrets.galaxy_api_key }} + git_branch: 'main' diff --git a/.github/workflows/yamllint.yaml b/.github/workflows/yamllint.yaml new file mode 100644 index 0000000..d744e9c --- /dev/null +++ b/.github/workflows/yamllint.yaml @@ -0,0 +1,23 @@ +--- +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 git repo' + uses: actions/checkout@v3 + + - name: 'Yamllint' + uses: karancode/yamllint-github-action@v2.0.0 + with: + yamllint_file_or_dir: '.' + yamllint_config_filepath: './.yamllint' diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f93e3ae --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# Ansible-Linting +.cache diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..cb32cb1 --- /dev/null +++ b/.yamllint @@ -0,0 +1,8 @@ +--- +extends: default + +rules: + # 150 chars should be enough, but don't fail if a line is longer + line-length: + max: 150 + level: warning diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..393d97b --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 L3D + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..807f23e --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# ansible_role_template +Template for Ansible roles diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..c8d9a89 --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,3 @@ +--- +# should we do a version check? (recomended) +submodules_versioncheck: false diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..0a1ffc5 --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,4 @@ +--- +- name: Run optional versionscheck + ansible.builtin.include_tasks: versioncheck.yml + when: submodules_versioncheck|bool diff --git a/tasks/versioncheck.yml b/tasks/versioncheck.yml new file mode 100644 index 0000000..dd22a1a --- /dev/null +++ b/tasks/versioncheck.yml @@ -0,0 +1,45 @@ +--- +# Copyright (c) 2021 L3D +# 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 + ansible.builtin.file: + path: '/etc/.ansible-version' + state: directory + mode: 0755 + when: submodules_versioncheck | bool + +- name: Check playbook version + become: true + ansible.builtin.slurp: + src: "/etc/.ansible-version/{{ playbook_version_path }}" + register: playbook_version + when: submodules_versioncheck | bool + ignore_errors: true + failed_when: false + +- name: Print remote role version + ansible.builtin.debug: + msg: "Remote role version: {{ playbook_version.content | default('Y3VycmVudGx5IG5vdCBkZXBsb3llZAo=') | b64decode | string }}" + when: submodules_versioncheck | bool + +- name: Print locale role version + ansible.builtin.debug: + msg: "Local role version: '{{ playbook_version_number | string }}'." + when: submodules_versioncheck | bool + +- name: Check if your version is outdated + 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: Write new version to remote disk + become: true + ansible.builtin.copy: + content: "{{ playbook_version_number }}" + dest: "/etc/.ansible-version/{{ playbook_version_path }}" + mode: '0644' + when: submodules_versioncheck | bool + tags: skip_ansible_lint_template-instead-of-copy diff --git a/vars/main.yml b/vars/main.yml new file mode 100644 index 0000000..7d4cd49 --- /dev/null +++ b/vars/main.yml @@ -0,0 +1,4 @@ +--- +# versionscheck +playbook_version_number: 02 # should be a integer +playbook_version_path: 'do1jlr.prometheus_ping_exporter.version'