Make UpgradeInitCommand and UpgradeLeapp{ToRemove,ToInstall,CommandOptions} per-role

When specific roles are deployed with custom images, for example CephStorage with
overcloud-minimal, then the LeappCommandOptions and/or the list of packages to
be removed/installed is not the same across all roles.

This change makes four parameters to be customized on a per-role basis:
UpgradeInitCommand
UpgradeLeappToRemove
UpgradeLeappToInstall
UpgradeLeappCommandOptions

Related-Bug: 1915067
Closes-Bug: rhbz#1936419
Change-Id: Ifd373f7aba6d98baa843b141de8a2266eaa71a0b
This commit is contained in:
Giulio Fidente 2021-03-09 17:01:49 +01:00
parent a94f17d98c
commit 155fe9454b

View File

@ -111,9 +111,17 @@ resources:
map_replace:
- map_replace:
- dnf_module_list: DnfStreams
upgrade_leapp_command_options: UpgradeLeappCommandOptions
upgrade_leapp_to_remove: UpgradeLeappToRemove
upgrade_leapp_to_install: UpgradeLeappToInstall
upgrade_init_command: UpgradeInitCommand
- values: {get_param: [RoleParameters]}
- values:
DnfStreams: {get_param: DnfStreams}
UpgradeLeappCommandOptions: {get_param: UpgradeLeappCommandOptions}
UpgradeLeappToRemove: {get_param: UpgradeLeappToRemove}
UpgradeLeappToInstall: {get_param: UpgradeLeappToInstall}
UpgradeInitCommand: {get_param: UpgradeInitCommand}
outputs:
role_data:
@ -145,7 +153,7 @@ outputs:
ansible_facts['distribution_major_version'] is version('7', '==') }}
upgrade_leapp_debug: {get_param: UpgradeLeappDebug}
upgrade_leapp_devel_skip: {get_param: UpgradeLeappDevelSkip}
upgrade_leapp_command_options: {get_param: UpgradeLeappCommandOptions}
upgrade_leapp_command_options: {get_attr: [RoleParametersValue, value, 'upgrade_leapp_command_options']}
upgrade_leapp_reboot_timeout: {get_param: UpgradeLeappRebootTimeout}
upgrade_leapp_post_reboot_delay: {get_param: UpgradeLeappPostRebootDelay}
vars:
@ -178,14 +186,14 @@ outputs:
state: latest
- name: "add packages into Leapp's to_remove file"
vars:
pkg_to_remove: { get_param: UpgradeLeappToRemove }
pkg_to_remove: {get_attr: [RoleParametersValue, value, 'upgrade_leapp_to_remove']}
lineinfile:
path: "/etc/leapp/transaction/to_remove"
line: "{{ item }}"
loop: "{{ pkg_to_remove }}"
- name: "add packages into Leapp's to_install file"
vars:
pkg_to_install: { get_param: UpgradeLeappToInstall }
pkg_to_install: {get_attr: [RoleParametersValue, value, 'upgrade_leapp_to_install']}
lineinfile:
path: "/etc/leapp/transaction/to_install"
line: "{{ item }}"
@ -243,7 +251,7 @@ outputs:
- ''
- - "#!/bin/bash\n\n"
- "if [[ -f /etc/resolv.conf.save ]] ; then rm /etc/resolv.conf.save; fi\n\n"
- {get_param: UpgradeInitCommand}
- {get_attr: [RoleParametersValue, value, 'upgrade_init_command']}
- name: Run UpgradeInitCommonCommand
shell:
list_join: