Merge "Ansible_playbook to select ddp package for NFV node provision" into stable/wallaby
This commit is contained in:
commit
89ca763607
|
@ -0,0 +1,84 @@
|
|||
---
|
||||
# Copyright 2022 Red Hat, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
- name: Overcloud Node kernel Ddp package select
|
||||
hosts: allovercloud
|
||||
any_errors_fatal: true
|
||||
gather_facts: false
|
||||
# 'ddp' is the OS-default package for all platforms
|
||||
vars:
|
||||
ddp_package: 'ddp'
|
||||
pre_tasks:
|
||||
- name: Wait for provisioned nodes to boot
|
||||
wait_for_connection:
|
||||
timeout: 600
|
||||
delay: 10
|
||||
connection: local
|
||||
|
||||
tasks:
|
||||
- name: gather facts
|
||||
setup:
|
||||
- name: Apply user provided Ddp package
|
||||
block:
|
||||
- name: Get latest version of specified Ddp package(s)
|
||||
shell: "ls --sort=version -r /lib/firmware/intel/ice/{{ ddp_package }}/ice[_-]?*.pkg*"
|
||||
register: ddp_package_files
|
||||
|
||||
- name: List available ddp_package_files
|
||||
debug:
|
||||
var: ddp_package_files.stdout
|
||||
|
||||
- name: Remove existing Ddp package
|
||||
become: true
|
||||
block:
|
||||
- name: Check if previous ddp/ice.pkg exists
|
||||
stat:
|
||||
path: "/lib/firmware/intel/ice/ddp/ice.pkg"
|
||||
register: ice_pkg
|
||||
- name: Remove ddp/ice.pkg if it exists
|
||||
file:
|
||||
path: "/lib/firmware/intel/ice/ddp/ice.pkg"
|
||||
state: absent
|
||||
when: ice_pkg.stat.exists
|
||||
- name: Check if ddp/ice.pkg.xz exists(rhel9)
|
||||
stat:
|
||||
path: "/lib/firmware/intel/ice/ddp/ice.pkg.xz"
|
||||
register: ice_pkg_xz
|
||||
- name: Remove ddp/ice.pkg.xz if it exists
|
||||
file:
|
||||
path: "/lib/firmware/intel/ice/ddp/ice.pkg.xz"
|
||||
state: absent
|
||||
when: ice_pkg_xz.stat.exists
|
||||
|
||||
- name: Select and deploy Ddp package
|
||||
become: true
|
||||
block:
|
||||
- name: Confiure ddp/ice.pkg
|
||||
vars:
|
||||
ddp_package_file: "{{ ddp_package_files.stdout.split('\n')[0] }}"
|
||||
file:
|
||||
src: '{{ ddp_package_file }}'
|
||||
dest: "/lib/firmware/intel/ice/ddp/ice.pkg.xz"
|
||||
state: link
|
||||
when: (ddp_package|string) != ''
|
||||
|
||||
- name: Load the new ice package
|
||||
shell: |-
|
||||
dracut -f
|
||||
rmmod ice
|
||||
modprobe ice
|
||||
when: ddp_package_files is defined
|
||||
|
||||
when: ddp_package|string != ""
|
Loading…
Reference in New Issue