Add container-update role and containers prepare step for Undercloud upgrades.
Since Rocky, the Undercloud is also containerized. The way to tell the undercloud which containers to use is by setting the right registry in containers-prepare-parameters.yaml file. This patch adds a new role named container-update which makes use of the parameters set in container-prep and substitute the relevant parameters inside containers-prepare-parameter.yaml file. The input for the role is the file used to configure the ContainerImagePrepare environment variable (defaults to containers-prepare-parameter.yaml). As part of the patch, it's been added a call to the newly added repo container-update into multinode-undercloud-upgrade.yaml playbook to update all needed parameters in containers-prepare-parameter.yaml before the Undercloud's upgrade. Change-Id: Icd4553f7c236080ebc529079142110a0b2e0ac2d
This commit is contained in:
parent
e1e470ae0e
commit
3a47baff8d
@ -19,6 +19,15 @@
|
||||
- role: build-test-packages
|
||||
- {role: install-built-repo, when: compressed_gating_repo is defined}
|
||||
|
||||
- name: Prepare containers for Upgrade
|
||||
hosts: undercloud
|
||||
gather_facts: false
|
||||
tags:
|
||||
- undercloud-upgrade
|
||||
roles:
|
||||
- role: container-update
|
||||
when: containerized_undercloud|default(false)|bool
|
||||
|
||||
- name: Run tripleo-upgrade role to upgrade undercloud
|
||||
hosts: undercloud
|
||||
tags:
|
||||
|
13
roles/container-update/README.md
Normal file
13
roles/container-update/README.md
Normal file
@ -0,0 +1,13 @@
|
||||
container-update
|
||||
================
|
||||
|
||||
This role levarages from the container-prep role which updates the needed
|
||||
parameters to set up the containers-prepare-parameter file and updates with
|
||||
the right values. It is mostly intended for upgrades and updates workflows in
|
||||
which we need to update the containers registry details before performing the
|
||||
upgrade.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
- containers_file: <containers-prepare-parameter.yaml> -- File containing the ContainerImagePrepare definition.
|
2
roles/container-update/defaults/main.yml
Normal file
2
roles/container-update/defaults/main.yml
Normal file
@ -0,0 +1,2 @@
|
||||
---
|
||||
containers_file: containers-prepare-parameter.yaml
|
4
roles/container-update/meta/main.yml
Normal file
4
roles/container-update/meta/main.yml
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
dependencies:
|
||||
- extras-common
|
||||
- container-prep
|
43
roles/container-update/tasks/main.yml
Normal file
43
roles/container-update/tasks/main.yml
Normal file
@ -0,0 +1,43 @@
|
||||
---
|
||||
- name: "Check if {{ containers_file }} exists"
|
||||
stat:
|
||||
path: "{{ working_dir }}/{{ containers_file }}"
|
||||
register: stat_cont_file
|
||||
failed_when: not stat_cont_file.stat.exists
|
||||
|
||||
- name: "Substitute containers registry to {{ docker_registry_host|default('nothing') }}/{{ docker_registry_namespace_used|default('nothing') }}"
|
||||
replace:
|
||||
path: "{{ working_dir }}/{{ containers_file }}"
|
||||
regexp: '^(\s*namespace:).*'
|
||||
replace: "\\1 {{ docker_registry_host }}/{{ docker_registry_namespace_used }}"
|
||||
when:
|
||||
- docker_registry_host is defined
|
||||
- docker_registry_namespace_used is defined
|
||||
|
||||
- name: "Substitute tag to {{ container_build_id|default('nothing') }}"
|
||||
replace:
|
||||
path: "{{ working_dir }}/{{ containers_file }}"
|
||||
regexp: '^(\s*tag:).*'
|
||||
replace: "\\1 {{ container_build_id }}"
|
||||
when: container_build_id is defined
|
||||
|
||||
- name: "Substitute name_prefix to {{ docker_prep_prefix|default('nothing') }}"
|
||||
replace:
|
||||
path: "{{ working_dir }}/{{ containers_file }}"
|
||||
regexp: '^(\s*name_prefix:).*'
|
||||
replace: "\\1 {{ docker_prep_prefix }}"
|
||||
when: docker_prep_prefix is defined
|
||||
|
||||
- name: "Substitute ceph_namespace to {{ docker_ceph_image|default('nothing') }}"
|
||||
replace:
|
||||
path: "{{ working_dir }}/{{ containers_file }}"
|
||||
regexp: '^(\s*ceph_namespace:).*'
|
||||
replace: "\\1 {{ docker_ceph_namespace }}"
|
||||
when: docker_ceph_namespace is defined
|
||||
|
||||
- name: "Substitute ceph_tag to {{ docker_ceph_tag|default('nothing') }}"
|
||||
replace:
|
||||
path: "{{ working_dir }}/{{ containers_file }}"
|
||||
regexp: '^(\s*ceph_tag:).*'
|
||||
replace: "\\1 {{ docker_ceph_tag }}"
|
||||
when: docker_ceph_tag is defined
|
Loading…
x
Reference in New Issue
Block a user