From 99faf1c0eb39c71652dcf2c1f34f560482c2f274 Mon Sep 17 00:00:00 2001 From: L3D Date: Tue, 25 Apr 2023 23:52:04 +0200 Subject: [PATCH 1/2] improve linting --- .github/workflows/ansible-linting-check.yml | 7 ++++++- meta/main.yml | 18 +++++++++++------- tasks/main.yml | 10 +++++----- tasks/versioncheck.yml | 19 ++++++++++--------- templates/nsswitch.conf.j2 | 3 +++ vars/main.yml | 3 +-- 6 files changed, 36 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ansible-linting-check.yml b/.github/workflows/ansible-linting-check.yml index 4d7dc8e..5ed3e8a 100644 --- a/.github/workflows/ansible-linting-check.yml +++ b/.github/workflows/ansible-linting-check.yml @@ -10,13 +10,18 @@ on: jobs: build: + runs-on: ubuntu-latest steps: - name: 'checkout git repo' uses: actions/checkout@v3 + with: + lfs: true + submodules: true + fetch-depth: 0 - name: 'Lint Ansible Playbook' uses: ansible/ansible-lint-action@v6 with: - targets: "." + path: "." diff --git a/meta/main.yml b/meta/main.yml index daa5038..73496b0 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -2,21 +2,25 @@ galaxy_info: role_name: avahi_client author: do1jlr - description: Avahi provides local hostname resolution using a "hostname.local" naming scheme. + description: Avahi provides local hostname resolution using the ".local" MDNS Domain. license: "MIT" - min_ansible_version: 2.11 - github_branch: main + min_ansible_version: "2.12" platforms: - - name: Archlinux - versions: all + - name: ArchLinux + versions: ['all'] - name: Debian - versions: all + versions: ['all'] - name: Ubuntu - versions: all + versions: ['all'] + - name: EL + versions: ['all'] + - name: Fedora + versions: ['all'] galaxy_tags: - avahi - client - local - mdns - bonjour + - linux dependencies: [] diff --git a/tasks/main.yml b/tasks/main.yml index 12caf5c..dab8e7a 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,17 +1,17 @@ --- -- name: run optional versionscheck +- name: Run Optional versionscheck ansible.builtin.include_tasks: versioncheck.yml - when: submodules_versioncheck|bool + when: submodules_versioncheck | bool -- name: gather os specific variables +- name: Gather os specific variables ansible.builtin.include_vars: "{{ item }}" with_first_found: - "vars/{{ ansible_os_family }}.yml" - "vars/os_fallback.yml" -- name: install mdns requirements +- name: Install MDNS requirements ansible.builtin.include_tasks: install.yml -- name: configure /etc/nsswitch.conf +- name: Configure /etc/nsswitch.conf ansible.builtin.include_tasks: nsswitch.yml when: avahi_client__configure_nsswitch | bool diff --git a/tasks/versioncheck.yml b/tasks/versioncheck.yml index 5128cc8..dd22a1a 100644 --- a/tasks/versioncheck.yml +++ b/tasks/versioncheck.yml @@ -8,37 +8,38 @@ path: '/etc/.ansible-version' state: directory mode: 0755 - when: submodules_versioncheck|bool + when: submodules_versioncheck | bool -- name: check playbook version +- name: Check playbook version become: true ansible.builtin.slurp: src: "/etc/.ansible-version/{{ playbook_version_path }}" register: playbook_version - when: submodules_versioncheck|bool + 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 + when: submodules_versioncheck | bool - name: Print locale role version ansible.builtin.debug: - msg: "Local role version: '{{ playbook_version_number|string }}'." - when: submodules_versioncheck|bool + 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 + - 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 ansible.builtin.copy: content: "{{ playbook_version_number }}" dest: "/etc/.ansible-version/{{ playbook_version_path }}" mode: '0644' - when: submodules_versioncheck|bool + when: submodules_versioncheck | bool + tags: skip_ansible_lint_template-instead-of-copy diff --git a/templates/nsswitch.conf.j2 b/templates/nsswitch.conf.j2 index 64621b0..98efa3f 100644 --- a/templates/nsswitch.conf.j2 +++ b/templates/nsswitch.conf.j2 @@ -1,6 +1,9 @@ # /etc/nsswitch.conf # {{ ansible_managed }} # +# See https://galaxy.ansible.com/l3d/avahi_client and +# https://galaxy.ansible.com/l3d/avahi for more details +# # Example configuration of GNU Name Service Switch functionality. # If you have the `glibc-doc-reference' and `info' packages installed, try: # `info libc "Name Service Switch"' for information about this file. diff --git a/vars/main.yml b/vars/main.yml index 7d3480a..08f78ab 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,4 +1,3 @@ --- -# versionscheck -playbook_version_number: 7 +playbook_version_number: 8 playbook_version_path: 'do1jlr.avahi_client.version' From c20810b80f8b4b03dde5b40d48fa3c0032a7ddc0 Mon Sep 17 00:00:00 2001 From: L3D Date: Wed, 26 Apr 2023 01:05:05 +0200 Subject: [PATCH 2/2] Some versions are EOL --- .github/workflows/ansible-debian-stretch.yml | 18 ------------------ .github/workflows/ansible-ubuntu-trusty.yml | 18 ------------------ 2 files changed, 36 deletions(-) delete mode 100644 .github/workflows/ansible-debian-stretch.yml delete mode 100644 .github/workflows/ansible-ubuntu-trusty.yml diff --git a/.github/workflows/ansible-debian-stretch.yml b/.github/workflows/ansible-debian-stretch.yml deleted file mode 100644 index c291320..0000000 --- a/.github/workflows/ansible-debian-stretch.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Ansible check debian:stretch - -# yamllint disable-line rule:truthy -on: [push, pull_request] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: 'checkout git repo' - uses: actions/checkout@v3 - - - name: 'ansible check with debian:stretch' - uses: roles-ansible/check-ansible-debian-stretch-action@master - with: - targets: "./" diff --git a/.github/workflows/ansible-ubuntu-trusty.yml b/.github/workflows/ansible-ubuntu-trusty.yml deleted file mode 100644 index 3c265a3..0000000 --- a/.github/workflows/ansible-ubuntu-trusty.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Ansible check ubuntu:trusty - -# yamllint disable-line rule:truthy -on: [push, pull_request] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: 'checkout git repo' - uses: actions/checkout@v3 - - - name: ansible check with ubuntu:trusty - uses: roles-ansible/check-ansible-ubuntu-trusty-action@master - with: - targets: "./"