From 0a889fd3621a860534c6399369f0e41e665638aa Mon Sep 17 00:00:00 2001 From: L3D Date: Wed, 1 Sep 2021 02:39:22 +0200 Subject: [PATCH] initial write role --- .github/workflows/{.galaxy.yml => galaxy.yml} | 0 defaults/main.yml | 27 +++++++++++++++++++ handlers/main.yml | 7 +++++ tasks/kernel_firmware_download.yml | 11 ++++++++ tasks/main.yml | 7 ++++- vars/main.yml | 4 +-- 6 files changed, 53 insertions(+), 3 deletions(-) rename .github/workflows/{.galaxy.yml => galaxy.yml} (100%) create mode 100644 handlers/main.yml create mode 100644 tasks/kernel_firmware_download.yml diff --git a/.github/workflows/.galaxy.yml b/.github/workflows/galaxy.yml similarity index 100% rename from .github/workflows/.galaxy.yml rename to .github/workflows/galaxy.yml diff --git a/defaults/main.yml b/defaults/main.yml index c8d9a89..9283e38 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,3 +1,30 @@ --- +# define download url prefix +rtl_nic__download_prefix: 'https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain' + +# define firmware list +rtl_nic__firmware: + - 'rtl_nic/rtl8107e-2.fw' + - 'rtl_nic/rtl8107e-1.fw' + - 'rtl_nic/rtl8168h-2.fw' + - 'rtl_nic/rtl8168h-1.fw' + - 'rtl_nic/rtl8168g-3.fw' + - 'rtl_nic/rtl8168g-2.fw' + - 'rtl_nic/rtl8106e-2.fw' + - 'rtl_nic/rtl8106e-1.fw' + - 'rtl_nic/rtl8411-2.fw' + - 'rtl_nic/rtl8411-1.fw' + - 'rtl_nic/rtl8402-1.fw' + - 'rtl_nic/rtl8168f-2.fw' + - 'rtl_nic/rtl8168f-1.fw' + - 'rtl_nic/rtl8105e-1.fw' + - 'rtl_nic/rtl8168e-3.fw' + - 'rtl_nic/rtl8168e-2.fw' + - 'rtl_nic/rtl8168e-1.fw' + - 'rtl_nic/rtl8168d-2.fw' + - 'rtl_nic/rtl8168d-1.fw' + +rtl_nic__path: '/lib/firmware' + # should we do a version check? (recomended) submodules_versioncheck: false diff --git a/handlers/main.yml b/handlers/main.yml new file mode 100644 index 0000000..c7b3c45 --- /dev/null +++ b/handlers/main.yml @@ -0,0 +1,7 @@ +--- +- name: update initramfs + become: true + listen: update initrd + ansible.builtin.command: + cmd: > + update-initramfs -k all -u diff --git a/tasks/kernel_firmware_download.yml b/tasks/kernel_firmware_download.yml new file mode 100644 index 0000000..c0c9db1 --- /dev/null +++ b/tasks/kernel_firmware_download.yml @@ -0,0 +1,11 @@ +--- +- name: download rtl_nic firmware + become: true + ansible.builtin.get_url: + url: "{{ rtl_nic__download_prefix }}/{{ item }}" + dest: "{{ rtl_nic__path }}/{{ item }}" + owner: root + group: root + mode: 0644 + with_items: "{{ rtl_nic__firmware }}" + notify: update initrd diff --git a/tasks/main.yml b/tasks/main.yml index b37444c..5ceb8a4 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,3 +1,8 @@ --- -- include_tasks: versioncheck.yml +- ansible.builtin.include_tasks: versioncheck.yml when: submodules_versioncheck|bool + +- ansible.builtin.include_tasks: kernel_firmware_download.yml + when: + - ansible_board_name == 'APU' + - ansible_product_name == 'APU' diff --git a/vars/main.yml b/vars/main.yml index bf4b0d9..427b3bb 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,4 +1,4 @@ --- # versionscheck -playbook_version_number: 02 # should be a integer -playbook_version_path: 'role-.version' +playbook_version_number: 3 +playbook_version_path: 'do1jlr.rtl_nic_firmware.version'