From cf568136d06dc25a13a6a5bc954e2aaaf6b34379 Mon Sep 17 00:00:00 2001 From: Dan Roth Date: Thu, 28 Dec 2023 17:58:59 +0100 Subject: [PATCH] fix(ansible-lint): satisfy ansible-lint --- .ansible-lint | 6 ++++++ .github/workflows/galaxy.yml | 22 +++++++++++++--------- galaxy.yml | 5 ++++- meta/runtime.yml | 2 +- roles/maintenance_10_linux/vars/RedHat.yml | 1 - roles/maintenance_12_ubuntu/tasks/main.yml | 10 +++++----- roles/maintenance_15_rhel/tasks/main.yml | 2 +- 7 files changed, 30 insertions(+), 18 deletions(-) diff --git a/.ansible-lint b/.ansible-lint index d42a252..c5e57cf 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -5,3 +5,9 @@ skip_list: - name[template] # When we use command, we do so because the corresponding module is insufficient - command-instead-of-module + # ansible-lint doesn't like us using vars. as a prefix for templating variables and wants us to prefix the rolename for variables. But we're using global variables not specific to a role + - var-naming + # The commits are the changelog + - galaxy[no-changelog] + # We're not 1.0.0 yet and that's ok + - galaxy[version-incorrect] diff --git a/.github/workflows/galaxy.yml b/.github/workflows/galaxy.yml index 9e12a56..b4b5ff6 100644 --- a/.github/workflows/galaxy.yml +++ b/.github/workflows/galaxy.yml @@ -2,6 +2,10 @@ name: Ansible Galaxy +tags: + - linux + - infrastructure + on: push: tags: @@ -12,14 +16,14 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - name: Set version in galaxy.yml - run: | - VERSION=${GITHUB_REF#refs/tags/v} - sed -re "s/^version:.*$/version: ${VERSION}/" -i galaxy.yml + - name: Set version in galaxy.yml + run: | + VERSION=${GITHUB_REF#refs/tags/v} + sed -re "s/^version:.*$/version: ${VERSION}/" -i galaxy.yml - - name: Upload collection to Ansible Galaxy - uses: ansible/ansible-publish-action@v1.0.0 - with: - api_key: ${{ secrets.GALAXY_API_KEY }} + - name: Upload collection to Ansible Galaxy + uses: ansible/ansible-publish-action@v1.0.0 + with: + api_key: ${{ secrets.GALAXY_API_KEY }} diff --git a/galaxy.yml b/galaxy.yml index 748de51..7b11331 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -1,3 +1,4 @@ +--- ### REQUIRED # The namespace of the collection. This can be a company/brand/organization or product namespace under which all # content lives. May only contain alphanumeric lowercase characters and underscores. Namespaces cannot start with @@ -29,7 +30,9 @@ license: # A list of tags you want to associate with the collection for indexing/searching. A tag name has the same character # requirements as 'namespace' and 'name' -tags: [] +tags: + - linux + - infrastructure # Collections that this collection requires to be installed for it to be usable. The key of the dict is the # collection label 'namespace.name'. The value is a version range diff --git a/meta/runtime.yml b/meta/runtime.yml index 63340fb..6230a64 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -1,3 +1,3 @@ --- -requires_ansible: ">=2.10" +requires_ansible: ">=2.12" diff --git a/roles/maintenance_10_linux/vars/RedHat.yml b/roles/maintenance_10_linux/vars/RedHat.yml index 89e7205..e1ec8d4 100644 --- a/roles/maintenance_10_linux/vars/RedHat.yml +++ b/roles/maintenance_10_linux/vars/RedHat.yml @@ -1,4 +1,3 @@ --- linux_allowed_login_since: -90days - diff --git a/roles/maintenance_12_ubuntu/tasks/main.yml b/roles/maintenance_12_ubuntu/tasks/main.yml index 3432d04..2563ac3 100644 --- a/roles/maintenance_12_ubuntu/tasks/main.yml +++ b/roles/maintenance_12_ubuntu/tasks/main.yml @@ -12,7 +12,7 @@ taskid: ignore-me name: bar -#(12-010) Update package lists and check for errors `apt update` +# (12-010) Update package lists and check for errors `apt update` - <<: *task vars: taskid: 12-010 @@ -22,7 +22,7 @@ changed_when: no -#(12-012) dkpg status: Are there packages which do not have the dpkg status ii or hi? `dpkg -l | grep -vE '^[hi]i'` Packages with status rc or similar can be removed completely with `dpkg -P`, be careful, usually the configuration files are removed. +# (12-012) dkpg status: Are there packages which do not have the dpkg status ii or hi? `dpkg -l | grep -vE '^[hi]i'` Packages with status rc or similar can be removed completely with `dpkg -P`, be careful, usually the configuration files are removed. - <<: *task vars: taskid: 12-012 @@ -42,7 +42,7 @@ changed_when: "ubuntu_dpkg_status.stdout_lines | length > 0" -#(12-017) apt: Simulate the package upgrade `apt --simulate upgrade`. +# (12-017) apt: Simulate the package upgrade `apt --simulate upgrade`. - <<: *task vars: taskid: 12-017 @@ -53,7 +53,7 @@ check_mode: yes -#(12-019) apt: Remove obsolete packages `apt autoremove`. +# (12-019) apt: Remove obsolete packages `apt autoremove`. - <<: *task vars: taskid: 12-019 @@ -62,7 +62,7 @@ autoremove: yes check_mode: yes -#(12-020) boot-config: Check boot configuration: Check ramdisk for actuality `update-initramfs -u` and keep bootloader up to date with `update-grub`. +# (12-020) boot-config: Check boot configuration: Check ramdisk for actuality `update-initramfs -u` and keep bootloader up to date with `update-grub`. - <<: *task vars: taskid: 12-020 diff --git a/roles/maintenance_15_rhel/tasks/main.yml b/roles/maintenance_15_rhel/tasks/main.yml index 6c8d5a4..a919a18 100644 --- a/roles/maintenance_15_rhel/tasks/main.yml +++ b/roles/maintenance_15_rhel/tasks/main.yml @@ -44,7 +44,7 @@ taskid: 15-011 name: "Does yum check-update work | Show exit status" ansible.builtin.debug: - msg: "Exited with: {{ yum_checkupdate_output.rc }}, Error is: {{ yum_checkupdate_output.stderr_lines|default('Not available') }}" + msg: "Exited with: {{ yum_checkupdate_output.rc }}, Error is: {{ yum_checkupdate_output.stderr_lines | default('Not available') }}" changed_when: "yum_checkupdate_output.rc not in [0, 100]" - <<: *task