From 542bd00f93b21a69e620bfe0c0066e1d935c336c Mon Sep 17 00:00:00 2001 From: L3D Date: Wed, 1 Sep 2021 03:00:02 +0200 Subject: [PATCH] improve running and docs --- README.md | 18 ++++++++++++++++-- defaults/main.yml | 3 ++- tasks/kernel_firmware_download.yml | 12 +++++++++++- vars/main.yml | 2 +- 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 807f23e..9d87446 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,16 @@ -# ansible_role_template -Template for Ansible roles + ansible role rtl_nic_firmware +=============================== + +Ansible role to deploy ``rtl_nic`` Firmware for APU. + +This role is only running at: +```yaml +when: + - ansible_board_name == 'APU' + - ansible_product_name == 'APU' +``` + +It will download the defined Firmware Files from the ``rtl_nic__firmware`` variable. +Then we run ``update-initramfs -k all -u``. + +You can change the downloaded firmware file names by modifying the default variables. diff --git a/defaults/main.yml b/defaults/main.yml index 9283e38..66a8f44 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -24,7 +24,8 @@ rtl_nic__firmware: - 'rtl_nic/rtl8168d-2.fw' - 'rtl_nic/rtl8168d-1.fw' -rtl_nic__path: '/lib/firmware' +rtl_nic__path_prefix: '/lib/firmware' +rtl_nic__path_suffix: 'rtl_nic' # should we do a version check? (recomended) submodules_versioncheck: false diff --git a/tasks/kernel_firmware_download.yml b/tasks/kernel_firmware_download.yml index c0c9db1..83730f2 100644 --- a/tasks/kernel_firmware_download.yml +++ b/tasks/kernel_firmware_download.yml @@ -1,9 +1,19 @@ --- +- name: "create {{ rtl_nic__path_prefix }}/{{ rtl_nic__path_suffix }}" + become: true + ansible.builtin.file: + path: "{{ rtl_nic__path_prefix }}/{{ item }}" + state: directory + mode: 0755 + owner: root + group: root + with_items: "{{ rtl_nic__path_suffix }}" + - name: download rtl_nic firmware become: true ansible.builtin.get_url: url: "{{ rtl_nic__download_prefix }}/{{ item }}" - dest: "{{ rtl_nic__path }}/{{ item }}" + dest: "{{ rtl_nic__path_prefix }}/{{ item }}" owner: root group: root mode: 0644 diff --git a/vars/main.yml b/vars/main.yml index 427b3bb..3e51fbd 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,4 +1,4 @@ --- # versionscheck -playbook_version_number: 3 +playbook_version_number: 4 playbook_version_path: 'do1jlr.rtl_nic_firmware.version'