Skip to content

Commit

Permalink
Merge pull request #401 from rebtoor/ddp_production_profile
Browse files Browse the repository at this point in the history
Make `edpm_ddp_package` role compliant with ansible-lint `production` profile
  • Loading branch information
openshift-ci[bot] authored Oct 9, 2023
2 parents 18505e8 + 6000bcb commit b78d104
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 16 deletions.
1 change: 0 additions & 1 deletion roles/edpm_ddp_package/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ galaxy_info:

galaxy_tags:
- edpm
- ddp_package


# List your role dependencies here, one per line. Be sure to remove the '[]' above,
Expand Down
43 changes: 28 additions & 15 deletions roles/edpm_ddp_package/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,17 @@
# under the License.

- name: Apply user provided DDP package
when: edpm_ddp_package | string != "" and edpm_ddp_package | string != "ddp"
block:
- name: List DDP packages
ansible.builtin.find:
path: "/lib/firmware/intel/ice/{{ edpm_ddp_package }}"
patterns: "ice[_-]?*.pkg*"
register: _find_ddp_package_files

- name: Get latest version of specified Ddp package(s)
ansible.builtin.shell: "ls --sort=version -r /lib/firmware/intel/ice/{{ edpm_ddp_package }}/ice[_-]?*.pkg*"
register: ddp_package_files
ansible.builtin.set_fact:
ddp_last_package_file: "{{ _find_ddp_package_files.files | map(attribute='path') | list | community.general.version_sort | last }}"

- name: Remove existing DDP package
become: true
Expand All @@ -44,31 +51,37 @@

- name: Select and deploy DDP package
become: true
when: ddp_last_package_file is defined
block:
- name: check package file name ice.pkg
- name: Check package file name ice.pkg
ansible.builtin.set_fact:
package_filename: "ice.pkg"
when: ice_pkg.stat.exists

- name: check package file name ice.pkg.xz
- name: Check package file name ice.pkg.xz
ansible.builtin.set_fact:
package_filename: "ice.pkg.xz"
when: ice_pkg_xz.stat.exists

- name: Confiure ddp/ice.pkg
vars:
ddp_package_file: "{{ ddp_package_files.stdout.split('\n')[0] }}"
ansible.builtin.file:
src: '{{ ddp_package_file }}'
src: '{{ ddp_last_package_file }}'
dest: "/lib/firmware/intel/ice/ddp/{{ package_filename }}"
state: link
when: edpm_ddp_package|string != ''
when: edpm_ddp_package | string != ''

- name: Rebuild initramfs image
ansible.builtin.command: dracut -f
register: _dracut_command_output
changed_when: _dracut_command_output.rc == 0
failed_when: _dracut_command_output.rc != 0

- name: Load the new ice package
ansible.builtin.shell: |-
dracut -f
rmmod ice
modprobe ice
when: ddp_package_files is defined
- name: Unload ice module
community.general.modprobe:
name: ice
state: absent

when: edpm_ddp_package|string != "" and edpm_ddp_package|string != "ddp"
- name: Looad new ice module
community.general.modprobe:
name: ice
state: present

0 comments on commit b78d104

Please sign in to comment.