1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_amdgpu_firmware.git synced 2024-08-16 14:59:49 +02:00

cleanup, linting and update

This commit is contained in:
L3D 2023-10-29 01:14:14 +02:00
parent 311e600f07
commit 76cb46170a
No known key found for this signature in database
GPG key ID: AD65B920933B4B20
21 changed files with 136 additions and 237 deletions

9
.github/dependabot.yml vendored Normal file
View file

@ -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"

View file

@ -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: "./"

View file

@ -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: "./"

View file

@ -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: "./"

View file

@ -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: "./"

View file

@ -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: "./"

View file

@ -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: "./"

View file

@ -6,17 +6,17 @@ on: [push, pull_request]
jobs: jobs:
build: build:
name: Ansible Lint
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - name: Checkout git repo
uses: actions/checkout@v4
- name: Lint Ansible Playbook
uses: ansible/ansible-lint-action@master
with: with:
targets: "." submodules: true
# [required] fetch-depth: 0
# Paths to ansible files (i.e., playbooks, tasks, handlers etc..)
args: "" - name: Run ansible-lint
# [optional] uses: ansible-actions/ansible-lint-action@v1.0.2
with:
target: "./"

View file

@ -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: "./"

View file

@ -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: "./"

View file

@ -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: "./"

View file

@ -1,20 +1,24 @@
--- ---
name: Galaxy release name: Galaxy-NG Roles Import
# yamllint disable-line rule:truthy # yamllint disable-line rule:truthy
on: on:
push:
branches: ['main']
release: release:
types: ['created'] types: ['created']
jobs: jobs:
build: build:
name: Galaxy Role Importer
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: checkout - name: 'Checkout git repo'
uses: actions/checkout@v2 uses: actions/checkout@v4
- name: galaxy with:
uses: robertdebock/galaxy-action@1.1.0 submodules: true
fetch-depth: 0
- name: 'Release on galaxy'
uses: ansible-actions/ansible-galaxy-action@v1.1.1
with: with:
galaxy_api_key: ${{ secrets.galaxy_api_key }} galaxy_api_key: ${{ secrets.galaxy_api_key }}

22
.github/workflows/j2lint-check.yml vendored Normal file
View file

@ -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: "./"

22
.github/workflows/yamllint-check.yml vendored Normal file
View file

@ -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: "./"

View file

@ -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 }

View file

@ -1,7 +1,7 @@
--- ---
- name: update initramfs - name: Run update initramfs
become: true become: true
listen: update initrd
ansible.builtin.command: ansible.builtin.command:
cmd: > cmd: >
update-initramfs -k all -u update-initramfs -k all -u
changed_when: false

View file

@ -2,18 +2,21 @@
galaxy_info: galaxy_info:
role_name: amdgpu_firmware role_name: amdgpu_firmware
author: do1jlr author: do1jlr
namespace: l3d
description: Ansible role to install some missing amdgpu Firmware for my AMD Thinkpad description: Ansible role to install some missing amdgpu Firmware for my AMD Thinkpad
license: "MIT" license: "MIT"
min_ansible_version: 2.11 min_ansible_version: '2.13'
github_branch: main
platforms: platforms:
- name: Debian - name: Debian
versions: all versions: ['all']
- name: Ubuntu - name: Ubuntu
versions: all versions: ['all']
galaxy_tags: galaxy_tags:
- apu - apu
- firmware - firmware
- rtl - rtl
- nic - nic
- amd
- amdgpu
- linux
dependencies: [] dependencies: []

16
tasks/firmware.yml Normal file
View file

@ -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'

View file

@ -1,21 +1,21 @@
--- ---
- name: "create {{ amdgpu__path_prefix }}/{{ amdgpu__path_suffix }}" - name: "Create directory for firmware"
become: true become: true
ansible.builtin.file: ansible.builtin.file:
path: "{{ amdgpu__path_prefix }}/{{ item }}" path: "{{ amdgpu__path_prefix }}/{{ item }}"
state: directory state: 'directory'
mode: 0755 mode: '0755'
owner: root owner: 'root'
group: root group: 'root'
with_items: "{{ amdgpu__path_suffix }}" loop: "{{ amdgpu__path_suffix }}"
- name: download amdgpu firmware - name: Download amdgpu firmware
become: true become: true
ansible.builtin.get_url: ansible.builtin.get_url:
url: "{{ amdgpu__download_prefix }}/{{ item }}" url: "{{ amdgpu__download_prefix }}/{{ item }}"
dest: "{{ amdgpu__path_prefix }}/{{ item }}" dest: "{{ amdgpu__path_prefix }}/{{ item }}"
owner: root owner: 'root'
group: root group: 'root'
mode: 0644 mode: '0644'
with_items: "{{ amdgpu__firmware }}" loop: "{{ amdgpu__firmware }}"
notify: update initrd notify: 'Run update initramfs'

View file

@ -1,9 +1,16 @@
--- ---
- name: run optional versioncheck - name: Run optional versioncheck
ansible.builtin.include_tasks: versioncheck.yml ansible.builtin.include_tasks:
when: submodules_versioncheck|bool file: 'versioncheck.yml'
when:
- submodules_versioncheck | bool
- name: download additional firmware on apu board - name: Install some firmware packages
ansible.builtin.include_tasks: kernel_firmware_download.yml ansible.builtin.include_tasks:
file: 'firmware.yml'
- name: Download additional firmware on apu board
ansible.builtin.include_tasks:
file: 'kernel_firmware_download.yml'
when: when:
- ansible_processor[1] == 'AuthenticAMD' - ansible_processor[1] == 'AuthenticAMD'

View file

@ -7,38 +7,38 @@
ansible.builtin.file: ansible.builtin.file:
path: '/etc/.ansible-version' path: '/etc/.ansible-version'
state: directory state: directory
mode: 0755 mode: '0755'
when: submodules_versioncheck|bool when: submodules_versioncheck | bool
- name: check playbook version - name: Check playbook version
become: true become: true
ansible.builtin.slurp: ansible.builtin.slurp:
src: "/etc/.ansible-version/{{ playbook_version_path }}" src: "/etc/.ansible-version/{{ playbook_version_path }}"
register: playbook_version register: playbook_version
when: submodules_versioncheck|bool when: submodules_versioncheck | bool
ignore_errors: true
failed_when: false failed_when: false
- name: Print remote role version - name: Print remote role version # noqa: H500
ansible.builtin.debug: ansible.builtin.debug:
msg: "Remote role version: {{ playbook_version.content | default('Y3VycmVudGx5IG5vdCBkZXBsb3llZAo=') | b64decode | string }}" 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: ansible.builtin.debug:
msg: "Local role version: '{{ playbook_version_number|string }}'." msg: "Local role version: '{{ playbook_version_number | string }}'."
when: submodules_versioncheck|bool when: submodules_versioncheck | bool
- name: Check if your version is outdated - name: Check if your version is outdated
ansible.builtin.fail: ansible.builtin.fail:
msg: "Your ansible module has the version '{{ playbook_version_number }}' and is outdated. You need to update it!" msg: "Your ansible module has the version '{{ playbook_version_number }}' and is outdated. You need to update it!"
when: 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 become: true
ansible.builtin.copy: ansible.builtin.copy:
content: "{{ playbook_version_number }}" content: "{{ playbook_version_number }}"
dest: "/etc/.ansible-version/{{ playbook_version_path }}" dest: "/etc/.ansible-version/{{ playbook_version_path }}"
mode: '0644' mode: '0644'
when: submodules_versioncheck|bool when: submodules_versioncheck | bool
tags: skip_ansible_lint_template-instead-of-copy