Set up right DNF module stream for Upgrades and Updates.
To ensure we get the right package versions we need to
make sure the right stream is configured for the
container-tools module.
This patch leverages the dnf module, which when passing as name
the @ identifier allows us to enable a stream for some specific
module [0], configuring the stream passed in DnfStreams heat parameter
in updates/upgrades task for step0.
If the stream passed in such parameter is alredy set, then the
module won't do anything else. On the contrary, it will disable
the current stream, enable the ones from DnfStreams and synchronize
the content.
By default the new Heat parameter defaults to empty list and it is
in the environment files where we set the right values depending
on the operation to perform (undercloud upgrade, overcloud update
or overcloud upgrade).
*****************************************************************
*BACKPORT NOTE: Add DNF module stream virt:8.2 in the overcloud *
*upgrade/update environment files. *
*****************************************************************
[0] - https://docs.ansible.com/ansible/latest/modules/dnf_module.html#examples
Closes-Bug: #1890631
Resolves: rhbz#1866479
Change-Id: Ib388af0a06bbb6172593dc2fd19748b770b2e335
(cherry picked from commit 4c2d5927e6
)
This commit is contained in:
parent
f3c4f47839
commit
4ee64076fb
|
@ -91,6 +91,13 @@ parameters:
|
|||
Mainly for CI purpose. It shouldn't matter on other distributions
|
||||
where it's disabled in the role. Set to true to skip the enforcement.
|
||||
type: string
|
||||
DnfStreams:
|
||||
default: []
|
||||
description: List of streams to be configured before updating packages. Each list
|
||||
element contains a dictionary with the following values defined
|
||||
module[mandatory], stream[mandatory] and profile[optional]. If the profile
|
||||
is not specified 'common' will be used instead.
|
||||
type: json
|
||||
|
||||
outputs:
|
||||
role_data:
|
||||
|
@ -227,6 +234,16 @@ outputs:
|
|||
- ''
|
||||
- - "#!/bin/bash\n\n"
|
||||
- {get_param: UpgradeInitCommonCommand}
|
||||
- name: Ensure DNF modules have the right stream
|
||||
vars:
|
||||
dnf_module_list: {get_param: DnfStreams}
|
||||
dnf:
|
||||
name: "@{{ item.module }}:{{ item.stream }}/{{ item.profile|default('common') }}"
|
||||
state: present
|
||||
loop: "{{ dnf_module_list|list }}"
|
||||
when:
|
||||
- ansible_distribution_major_version >= '8'
|
||||
- dnf_module_list|length > 0
|
||||
- name: Ensure TripleO prerequisite packages are installed
|
||||
package:
|
||||
name:
|
||||
|
@ -318,6 +335,17 @@ outputs:
|
|||
- step|int == 0
|
||||
- ansible_distribution == 'RedHat'
|
||||
- not (skip_rhel_enforcement | bool)
|
||||
- name: Ensure DNF modules have the right stream
|
||||
vars:
|
||||
dnf_module_list: {get_param: DnfStreams}
|
||||
dnf:
|
||||
name: "@{{ item.module }}:{{ item.stream }}/{{ item.profile|default('common') }}"
|
||||
state: present
|
||||
loop: "{{ dnf_module_list|list }}"
|
||||
when:
|
||||
- step|int == 0
|
||||
- ansible_distribution_major_version >= '8'
|
||||
- dnf_module_list|length > 0
|
||||
- name: Check for existing yum.pid
|
||||
stat: path=/run/yum.pid
|
||||
register: yum_pid_file
|
||||
|
|
|
@ -36,6 +36,13 @@ parameters:
|
|||
Mainly for CI purpose. It shouldn't matter on other distributions
|
||||
where it's disabled in the role. Set to true to skip the enforcement.
|
||||
type: string
|
||||
DnfStreams:
|
||||
default: []
|
||||
description: List of streams to be configured before updating packages. Each list
|
||||
element contains a dictionary with the following values defined
|
||||
module[mandatory], stream[mandatory] and profile[optional]. If the profile
|
||||
is not specified 'common' will be used instead.
|
||||
type: json
|
||||
|
||||
outputs:
|
||||
role_data:
|
||||
|
@ -60,6 +67,17 @@ outputs:
|
|||
- step|int == 0
|
||||
- ansible_distribution == 'RedHat'
|
||||
- not (skip_rhel_enforcement | bool)
|
||||
- name: Ensure DNF modules have the right stream
|
||||
vars:
|
||||
dnf_module_list: {get_param: DnfStreams}
|
||||
dnf:
|
||||
name: "@{{ item.module }}:{{ item.stream }}/{{ item.profile|default('common') }}"
|
||||
state: present
|
||||
loop: "{{ dnf_module_list|list }}"
|
||||
when:
|
||||
- step|int == 0
|
||||
- ansible_distribution_major_version >= '8'
|
||||
- dnf_module_list|length > 0
|
||||
- name: Special treatment for OpenvSwitch
|
||||
tripleo_ovs_upgrade:
|
||||
when:
|
||||
|
|
|
@ -6,3 +6,4 @@ resource_registry:
|
|||
|
||||
parameter_defaults:
|
||||
UndercloudUpgrade: true
|
||||
DnfStreams: [{'module':'container-tools', 'stream':'2.0'}]
|
||||
|
|
|
@ -7,3 +7,4 @@ resource_registry:
|
|||
|
||||
parameter_defaults:
|
||||
CephAnsiblePlaybook: default
|
||||
DnfStreams: [{'module':'container-tools', 'stream':'2.0'}]
|
||||
|
|
|
@ -17,3 +17,4 @@ parameter_defaults:
|
|||
UpgradeInitCommonCommand: |
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
DnfStreams: [{'module':'container-tools', 'stream':'2.0'}]
|
||||
|
|
Loading…
Reference in New Issue