From 698ab80d8b8b862a8db58c06902dc78b188ea92c Mon Sep 17 00:00:00 2001 From: L3D Date: Wed, 20 Jan 2021 23:03:13 +0100 Subject: [PATCH] Initial commit --- .github/FUNDING.yml | 6 + .github/galaxy.svg | 366 ++++++++++++++++++ .github/license.svg | 217 +++++++++++ .github/workflows/ansible-alpine-latest.yml | 18 + .../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-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-31.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 | 22 ++ .github/workflows/ansible-ubuntu-bionic.yml | 18 + .github/workflows/ansible-ubuntu-latest.yml | 18 + .github/workflows/ansible-ubuntu-trusty.yml | 18 + .github/workflows/yamllint.yaml | 22 ++ .yamllint | 8 + LICENSE | 21 + README.md | 28 ++ defaults/main.yml | 3 + tasks/main.yml | 3 + tasks/versioncheck.yml | 46 +++ vars/main.yml | 4 + 29 files changed, 1052 insertions(+) create mode 100644 .github/FUNDING.yml create mode 100644 .github/galaxy.svg create mode 100644 .github/license.svg create mode 100644 .github/workflows/ansible-alpine-latest.yml 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-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-31.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-bionic.yml create mode 100644 .github/workflows/ansible-ubuntu-latest.yml create mode 100644 .github/workflows/ansible-ubuntu-trusty.yml create mode 100644 .github/workflows/yamllint.yaml 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/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..90acf04 --- /dev/null +++ b/.github/galaxy.svg @@ -0,0 +1,366 @@ + + + + + + + image/svg+xml + + + + + + 3D <l3d@c3woc.de> + + + + + MIT License + + + + + + + + + + + + + + + + + + + + + + + + MIT + MIT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + do1jlr.role_name + do1jlr.role_name + + 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-alpine-latest.yml b/.github/workflows/ansible-alpine-latest.yml new file mode 100644 index 0000000..07bfff0 --- /dev/null +++ b/.github/workflows/ansible-alpine-latest.yml @@ -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: "./" 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-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-31.yml b/.github/workflows/ansible-fedora-31.yml new file mode 100644 index 0000000..08502fe --- /dev/null +++ b/.github/workflows/ansible-fedora-31.yml @@ -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: "./" 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..41dcb97 --- /dev/null +++ b/.github/workflows/ansible-linting-check.yml @@ -0,0 +1,22 @@ +--- +name: Ansible Lint check + +# yamllint disable-line rule:truthy +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] diff --git a/.github/workflows/ansible-ubuntu-bionic.yml b/.github/workflows/ansible-ubuntu-bionic.yml new file mode 100644 index 0000000..0f9edd8 --- /dev/null +++ b/.github/workflows/ansible-ubuntu-bionic.yml @@ -0,0 +1,18 @@ +--- +name: Ansible check ubuntu:bionic + +# 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:bionic + uses: roles-ansible/check-ansible-ubuntu-bionic-action@master + 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/ansible-ubuntu-trusty.yml b/.github/workflows/ansible-ubuntu-trusty.yml new file mode 100644 index 0000000..6cde8b8 --- /dev/null +++ b/.github/workflows/ansible-ubuntu-trusty.yml @@ -0,0 +1,18 @@ +--- +name: Ansible check ubuntu:trusty + +# 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:trusty + uses: roles-ansible/check-ansible-ubuntu-trusty-action@master + with: + targets: "./" diff --git a/.github/workflows/yamllint.yaml b/.github/workflows/yamllint.yaml new file mode 100644 index 0000000..39c49f8 --- /dev/null +++ b/.github/workflows/yamllint.yaml @@ -0,0 +1,22 @@ +--- +name: 'Yamllint GitHub Actions' + +# yamllint disable-line rule:truthy +on: [push, pull_request] + +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' + yamllint_strict: false + yamllint_comment: true +# env: +# GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN } 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..10e0d6d --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 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..0d10704 --- /dev/null +++ b/README.md @@ -0,0 +1,28 @@ +# ansible_role_template +Template for Ansible roles + + Testing +---------- +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 | +| :--------- | :---------------- | +| [![Ansible Lint check](https://github.com/roles-ansible/ansible_role_template/workflows/Ansible%20Lint%20check/badge.svg)](https://github.com/roles-ansible/ansible_role_template/actions?query=workflow%3A%22Ansible+Lint+check%22) | [ansible-lint action](https://github.com/marketplace/actions/ansible-lint) | +| ![Yamllint GitHub Actions](https://github.com/roles-ansible/ansible_role_template/workflows/Yamllint%20GitHub%20Actions/badge.svg) | [yamllint gitHub actions](https://github.com/marketplace/actions/yamllint-github-action) | +| | | +| [![Ansible check debian:stable](https://github.com/roles-ansible/ansible_role_template/workflows/Ansible%20check%20debian:stable/badge.svg)](https://github.com/roles-ansible/ansible_role_template/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/ansible_role_template/workflows/Ansible%20check%20debian:latest/badge.svg)](https://github.com/roles-ansible/ansible_role_template/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/ansible_role_template/workflows/Ansible%20check%20debian:sid/badge.svg)](https://github.com/roles-ansible/ansible_role_template/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/ansible_role_template/workflows/Ansible%20check%20debian:buster/badge.svg)](https://github.com/roles-ansible/ansible_role_template/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:stretch](https://github.com/roles-ansible/ansible_role_template/workflows/Ansible%20check%20debian:stretch/badge.svg)](https://github.com/roles-ansible/ansible_role_template/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/ansible_role_template/workflows/Ansible%20check%20archlinux:latest/badge.svg)](https://github.com/roles-ansible/ansible_role_template/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/ansible_role_template/workflows/Ansible%20check%20ubuntu:latest/badge.svg)](https://github.com/roles-ansible/ansible_role_template/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/ansible_role_template/workflows/Ansible%20check%20ubuntu:bionic/badge.svg)](https://github.com/roles-ansible/ansible_role_template/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:trusty](https://github.com/roles-ansible/ansible_role_template/workflows/Ansible%20check%20ubuntu:trusty/badge.svg)](https://github.com/roles-ansible/ansible_role_template/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 centos:latest](https://github.com/roles-ansible/ansible_role_template/workflows/Ansible%20check%20centos:latest/badge.svg)](https://github.com/roles-ansible/ansible_role_template/actions?query=workflow%3A%22Ansible+check+centos%3Alatest%22) | [ansible test with centos latest](https://github.com/marketplace/actions/check-ansible-centos-latest) | +| [![Ansible check centos:centos8](https://github.com/roles-ansible/ansible_role_template/workflows/Ansible%20check%20centos:centos8/badge.svg)](https://github.com/roles-ansible/ansible_role_template/actions?query=workflow%3A%22Ansible+check+centos%3Acentos8%22) | [ansible test with centos centos8](https://github.com/marketplace/actions/check-ansible-centos-centos8) | +| [![Ansible check centos:latest](https://github.com/roles-ansible/ansible_role_template/workflows/Ansible%20check%20centos:centos7/badge.svg)](https://github.com/roles-ansible/ansible_role_template/actions?query=workflow%3A%22Ansible+check+centos%3Acentos7%22) | [ansible test with centos centos7](https://github.com/marketplace/actions/check-ansible-centos-centos7) | 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..b37444c --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- include_tasks: versioncheck.yml + when: submodules_versioncheck|bool diff --git a/tasks/versioncheck.yml b/tasks/versioncheck.yml new file mode 100644 index 0000000..1ca07b5 --- /dev/null +++ b/tasks/versioncheck.yml @@ -0,0 +1,46 @@ +--- +- 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: "/etc/.ansible-version/{{ playbook_version_path }}" + register: playbook_version + when: submodules_versioncheck|bool + ignore_errors: true + failed_when: false + +- 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: check if '/etc/ansible-version/' is empty + find: + paths: '/etc/ansible-version/' + register: filesFound + +- name: write new version to remote disk + become: true + copy: + content: "{{ playbook_version_number }}" + dest: "/etc/.ansible-version/{{ playbook_version_path }}" + mode: '0644' + when: submodules_versioncheck|bool diff --git a/vars/main.yml b/vars/main.yml new file mode 100644 index 0000000..bf4b0d9 --- /dev/null +++ b/vars/main.yml @@ -0,0 +1,4 @@ +--- +# versionscheck +playbook_version_number: 02 # should be a integer +playbook_version_path: 'role-.version'