From 76cb46170a6e3514f22fb0d9af1b4678965ce892 Mon Sep 17 00:00:00 2001 From: L3D Date: Sun, 29 Oct 2023 01:14:14 +0200 Subject: [PATCH] cleanup, linting and update --- .github/dependabot.yml | 9 +++++++ .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-linting-check.yml | 20 +++++++------- .github/workflows/ansible-ubuntu-bionic.yml | 18 ------------- .github/workflows/ansible-ubuntu-latest.yml | 18 ------------- .github/workflows/ansible-ubuntu-trusty.yml | 18 ------------- .github/workflows/galaxy.yml | 18 ++++++++----- .github/workflows/j2lint-check.yml | 22 ++++++++++++++++ .github/workflows/yamllint-check.yml | 22 ++++++++++++++++ .github/workflows/yamllint.yaml | 22 ---------------- handlers/main.yml | 4 +-- meta/main.yml | 11 +++++--- tasks/firmware.yml | 16 ++++++++++++ tasks/kernel_firmware_download.yml | 24 ++++++++--------- tasks/main.yml | 17 ++++++++---- tasks/versioncheck.yml | 26 +++++++++---------- 21 files changed, 136 insertions(+), 237 deletions(-) create mode 100644 .github/dependabot.yml delete mode 100644 .github/workflows/ansible-debian-bullseye.yml delete mode 100644 .github/workflows/ansible-debian-buster.yml delete mode 100644 .github/workflows/ansible-debian-latest.yml delete mode 100644 .github/workflows/ansible-debian-sid.yml delete mode 100644 .github/workflows/ansible-debian-stable.yml delete mode 100644 .github/workflows/ansible-debian-stretch.yml delete mode 100644 .github/workflows/ansible-ubuntu-bionic.yml delete mode 100644 .github/workflows/ansible-ubuntu-latest.yml delete mode 100644 .github/workflows/ansible-ubuntu-trusty.yml create mode 100644 .github/workflows/j2lint-check.yml create mode 100644 .github/workflows/yamllint-check.yml delete mode 100644 .github/workflows/yamllint.yaml create mode 100644 tasks/firmware.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..dde6f4a --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,9 @@ +--- +# See https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates +version: 2 +updates: + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/ansible-debian-bullseye.yml b/.github/workflows/ansible-debian-bullseye.yml deleted file mode 100644 index 4b7c45d..0000000 --- a/.github/workflows/ansible-debian-bullseye.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -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 deleted file mode 100644 index d76b02c..0000000 --- a/.github/workflows/ansible-debian-buster.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -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 deleted file mode 100644 index f7eb5b6..0000000 --- a/.github/workflows/ansible-debian-latest.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -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 deleted file mode 100644 index 2e3215a..0000000 --- a/.github/workflows/ansible-debian-sid.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -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 deleted file mode 100644 index e47f773..0000000 --- a/.github/workflows/ansible-debian-stable.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -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 deleted file mode 100644 index c947cae..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: - - 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-linting-check.yml b/.github/workflows/ansible-linting-check.yml index 41dcb97..1a76d38 100644 --- a/.github/workflows/ansible-linting-check.yml +++ b/.github/workflows/ansible-linting-check.yml @@ -6,17 +6,17 @@ on: [push, pull_request] jobs: build: - + name: Ansible Lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - - name: Lint Ansible Playbook - uses: ansible/ansible-lint-action@master + - name: Checkout git repo + uses: actions/checkout@v4 with: - targets: "." - # [required] - # Paths to ansible files (i.e., playbooks, tasks, handlers etc..) - args: "" - # [optional] + submodules: true + fetch-depth: 0 + + - name: Run ansible-lint + uses: ansible-actions/ansible-lint-action@v1.0.2 + with: + target: "./" diff --git a/.github/workflows/ansible-ubuntu-bionic.yml b/.github/workflows/ansible-ubuntu-bionic.yml deleted file mode 100644 index 0f9edd8..0000000 --- a/.github/workflows/ansible-ubuntu-bionic.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -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 deleted file mode 100644 index b9544a5..0000000 --- a/.github/workflows/ansible-ubuntu-latest.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -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 deleted file mode 100644 index 6cde8b8..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: - - 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/galaxy.yml b/.github/workflows/galaxy.yml index b5dc0ec..b44f94e 100644 --- a/.github/workflows/galaxy.yml +++ b/.github/workflows/galaxy.yml @@ -1,20 +1,24 @@ --- -name: Galaxy release +name: Galaxy-NG Roles Import # yamllint disable-line rule:truthy on: - push: - branches: ['main'] release: types: ['created'] jobs: build: + name: Galaxy Role Importer runs-on: ubuntu-latest + steps: - - name: checkout - uses: actions/checkout@v2 - - name: galaxy - uses: robertdebock/galaxy-action@1.1.0 + - name: 'Checkout git repo' + uses: actions/checkout@v4 + with: + submodules: true + fetch-depth: 0 + + - name: 'Release on galaxy' + uses: ansible-actions/ansible-galaxy-action@v1.1.1 with: galaxy_api_key: ${{ secrets.galaxy_api_key }} diff --git a/.github/workflows/j2lint-check.yml b/.github/workflows/j2lint-check.yml new file mode 100644 index 0000000..00c7861 --- /dev/null +++ b/.github/workflows/j2lint-check.yml @@ -0,0 +1,22 @@ +--- +name: Jinja2 Linting check + +# yamllint disable-line rule:truthy +on: [push, pull_request] + +jobs: + build: + name: Jinja2 Linting + runs-on: ubuntu-latest + + steps: + - name: Checkout git repo + uses: actions/checkout@v4 + with: + submodules: true + fetch-depth: 0 + + - name: Run j2lint + uses: ansible-actions/j2lint-action@v0.0.1 + with: + target: "./" diff --git a/.github/workflows/yamllint-check.yml b/.github/workflows/yamllint-check.yml new file mode 100644 index 0000000..5e62f57 --- /dev/null +++ b/.github/workflows/yamllint-check.yml @@ -0,0 +1,22 @@ +--- +name: Yamllint check + +# yamllint disable-line rule:truthy +on: [push, pull_request] + +jobs: + build: + name: Yamllint + runs-on: ubuntu-latest + + steps: + - name: Checkout git repo + uses: actions/checkout@v4 + with: + submodules: true + fetch-depth: 0 + + - name: Run yamllint + uses: ansible-actions/yamllint-action@v0.0.1 + with: + target: "./" diff --git a/.github/workflows/yamllint.yaml b/.github/workflows/yamllint.yaml deleted file mode 100644 index 39c49f8..0000000 --- a/.github/workflows/yamllint.yaml +++ /dev/null @@ -1,22 +0,0 @@ ---- -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/handlers/main.yml b/handlers/main.yml index c7b3c45..70c540e 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,7 +1,7 @@ --- -- name: update initramfs +- name: Run update initramfs become: true - listen: update initrd ansible.builtin.command: cmd: > update-initramfs -k all -u + changed_when: false diff --git a/meta/main.yml b/meta/main.yml index efdbcf0..30bb6da 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -2,18 +2,21 @@ galaxy_info: role_name: amdgpu_firmware author: do1jlr + namespace: l3d description: Ansible role to install some missing amdgpu Firmware for my AMD Thinkpad license: "MIT" - min_ansible_version: 2.11 - github_branch: main + min_ansible_version: '2.13' platforms: - name: Debian - versions: all + versions: ['all'] - name: Ubuntu - versions: all + versions: ['all'] galaxy_tags: - apu - firmware - rtl - nic + - amd + - amdgpu + - linux dependencies: [] diff --git a/tasks/firmware.yml b/tasks/firmware.yml new file mode 100644 index 0000000..27e777f --- /dev/null +++ b/tasks/firmware.yml @@ -0,0 +1,16 @@ +--- +- name: Install firmware packages + become: true + ansible.builtin.package: + name: "{{ item }}" + state: 'present' + loop: + - 'firmware-linux' + - 'firmware-linux-free' + - 'firmware-linux-nonfree' + - 'firmware-misc-nonfree' + - 'fwupd' + - 'fwupd-amd64-signed' + - 'fwupd-doc' + - 'fwupd-unsigned' + - 'gnome-firmware' diff --git a/tasks/kernel_firmware_download.yml b/tasks/kernel_firmware_download.yml index 0422bbe..a741a9e 100644 --- a/tasks/kernel_firmware_download.yml +++ b/tasks/kernel_firmware_download.yml @@ -1,21 +1,21 @@ --- -- name: "create {{ amdgpu__path_prefix }}/{{ amdgpu__path_suffix }}" +- name: "Create directory for firmware" become: true ansible.builtin.file: path: "{{ amdgpu__path_prefix }}/{{ item }}" - state: directory - mode: 0755 - owner: root - group: root - with_items: "{{ amdgpu__path_suffix }}" + state: 'directory' + mode: '0755' + owner: 'root' + group: 'root' + loop: "{{ amdgpu__path_suffix }}" -- name: download amdgpu firmware +- name: Download amdgpu firmware become: true ansible.builtin.get_url: url: "{{ amdgpu__download_prefix }}/{{ item }}" dest: "{{ amdgpu__path_prefix }}/{{ item }}" - owner: root - group: root - mode: 0644 - with_items: "{{ amdgpu__firmware }}" - notify: update initrd + owner: 'root' + group: 'root' + mode: '0644' + loop: "{{ amdgpu__firmware }}" + notify: 'Run update initramfs' diff --git a/tasks/main.yml b/tasks/main.yml index 684633d..40ad6d0 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,9 +1,16 @@ --- -- name: run optional versioncheck - ansible.builtin.include_tasks: versioncheck.yml - when: submodules_versioncheck|bool +- name: Run optional versioncheck + ansible.builtin.include_tasks: + file: 'versioncheck.yml' + when: + - submodules_versioncheck | bool -- name: download additional firmware on apu board - ansible.builtin.include_tasks: kernel_firmware_download.yml +- name: Install some firmware packages + ansible.builtin.include_tasks: + file: 'firmware.yml' + +- name: Download additional firmware on apu board + ansible.builtin.include_tasks: + file: 'kernel_firmware_download.yml' when: - ansible_processor[1] == 'AuthenticAMD' diff --git a/tasks/versioncheck.yml b/tasks/versioncheck.yml index 5128cc8..7dd80c5 100644 --- a/tasks/versioncheck.yml +++ b/tasks/versioncheck.yml @@ -7,38 +7,38 @@ ansible.builtin.file: path: '/etc/.ansible-version' state: directory - mode: 0755 - when: submodules_versioncheck|bool + mode: '0755' + 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 - ignore_errors: true + when: submodules_versioncheck | bool failed_when: false -- name: Print remote role version +- name: Print remote role version # noqa: H500 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 +- name: Print locale role version # noqa: H500 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