[ffwd] Allow users to replace environment files

A new option allows user to replace the content of specific
environment files which are listed in the "overcloud deploy"
bash script which is parsed and used here.

This is useful when the content of a file is known to
have changed between the source and destination release.
The feature is implemented for FFWD only right now,
but it could be used for any kind of upgrade/update process.

Change-Id: I027770e0ac8c73896d2b57218da3a5063b9707fd
This commit is contained in:
Luigi Toscano 2021-04-29 14:19:49 +02:00
parent 6f451e66dd
commit 4458ab622a
4 changed files with 34 additions and 0 deletions

View File

@ -300,6 +300,13 @@ subparsers:
help: |
Fast Forward Upgrade compute nodes one by one
default: false
overcloud-ffu-replace-env-files:
type: KeyValueList
help: |
A comma-separated list of key/values which describe the environment files
whose content should be replaced during the upgrade phase.
The value must be the path to the new file, while the key must match
the file name to replaced as it shows inside the deploy script.
- title: Set up FFU packages
options:
mirror:

View File

@ -0,0 +1,19 @@
---
- name: determine the name of the replaced environment file
shell:
cat {{ overcloud_deploy_script }} | grep '-e .\+{{ item.key }} ' | sed 's/.\+ \(.\+{{ item.key }}\) .*/\1/'
register: ffu_replaced_env_file
- block:
- name: save a copy of the replaced environment configuration file
copy:
remote_src: true
src: "{{ ffu_replaced_env_file.stdout }}"
dest: "{{ ffu_replaced_env_file.stdout }}.orig.yaml"
- name: replace the environment configuration file with the new one
copy:
src: "{{ item.value }}"
dest: "{{ ffu_replaced_env_file.stdout }}"
when: ffu_replaced_env_file.stdout|length > 0

View File

@ -0,0 +1,4 @@
---
- name: loop over the replacement environment configuration files
include_tasks: replace_environment_file.yaml
loop: "{{ install.overcloud.ffu.replace.env.files | default({}) | dict2items }}"

View File

@ -135,6 +135,10 @@
import_tasks: convert_tls_templates.yaml
tags: ffu_overcloud_prepare
- name: replace environment files
import_tasks: ../common/replace_environment_files.yaml
tags: ffu_overcloud_prepare
- name: run overcloud upgrade prepare
import_tasks: ../upgrade/overcloud_upgrade_prepare.yml
tags: ffu_overcloud_prepare