Simplify ffwd2 CIP stein parameters.

Currently, the ContainerImagePrepare parameters required for FFWD2
to work are harcoded in the defaults/main.yaml. However, the
namespace_stein variable, should point at the same value the namespace
variable points. This patch simplifies a little the logic, adds a new
fact full_namespace that stores the content of the namespace field from
the containers-prepare-parameters.yaml file and assigns the namespace_stein
key to it.

Change-Id: I07967e0590aee9c86a6427469914f65fbdb3929d
This commit is contained in:
Jose Luis Franco Arza 2020-04-17 19:10:15 +02:00
parent 61281a4b49
commit cdce7a9cb6
2 changed files with 14 additions and 20 deletions

View File

@ -253,6 +253,6 @@ ceph3_registry_params:
# stein registry parameters
stein_registry_params:
namespace_stein: "rhos-qe-mirror-tlv.usersys.redhat.com:5002/rh-osbs"
namespace_stein: "{{ full_namespace }}"
tag_stein: "20200115.1"
name_prefix_stein: "rhosp15-openstack-"

View File

@ -54,14 +54,14 @@
- name: set namespaces
set_fact:
ceph_namespace: "{{ (prep_param_raw.content|b64decode|from_yaml).parameter_defaults.ContainerImagePrepare[0].set.ceph_namespace.split('/')[0] }}"
def_namespace: "{{ (prep_param_raw.content|b64decode|from_yaml).parameter_defaults.ContainerImagePrepare[0].set.namespace.split('/')[0] }}"
full_namespace: "{{ (prep_param_raw.content|b64decode|from_yaml).parameter_defaults.ContainerImagePrepare[0].set.namespace }}"
- name: set container_insecure_registries for undercloud upgrade
ini_file:
path: "{{ undercloud_conf }}"
section: DEFAULT
option: container_insecure_registries
value: "{{ def_namespace }},{{ ceph_namespace }}"
value: "{{ full_namespace.split('/')[0] }},{{ ceph_namespace }}"
when: defined_container_registry.stdout_lines|length == 0
- name: Set the neutron_driver to openvswitch for the Undercloud
@ -73,45 +73,39 @@
when: custom_uc_containers.stat.exists
# adjust containers-prepare-parameter for FFWD
- block:
- name: "Add ceph3 namespace parameters in {{ uc_containers_prepare_file }}"
lineinfile:
path: "{{ working_dir }}/{{ uc_containers_prepare_file }}"
insertbefore: "^.*name_prefix:.*$"
line: " {{ item.key }}: {{ item.value }}"
loop: "{{ ceph3_registry_params | dict2items }}"
- name: "Add stein registry parameters in {{ uc_containers_prepare_file }}"
lineinfile:
path: "{{ working_dir }}/{{ uc_containers_prepare_file }}"
insertafter: "^.*namespace:.*$"
line: " {{ item.key }}: {{ item.value }}"
loop: "{{ stein_registry_params | dict2items }}"
- name: "Add stein registry parameters in {{ uc_containers_prepare_file }}"
lineinfile:
path: "{{ working_dir }}/{{ uc_containers_prepare_file }}"
insertafter: "^.*namespace:.*$"
line: " {{ item.key }}: {{ item.value }}"
regexp: "^ {{ item.key }}: {{ item.value }}"
loop: "{{ stein_registry_params | combine(ceph3_registry_params) | dict2items }}"
when:
- custom_uc_containers.stat.exists
- ffu_undercloud_upgrade|bool
- name: adjust existing container_insecure_registries for undercloud upgrade
vars:
reg_list: '{{ defined_insecure_registry.stdout.split(",")|union([def_namespace])|union([ceph_namespace])|unique|join(",") }}'
reg_list: '{{ defined_insecure_registry.stdout.split(",")|union([full_namespace.split("/")[0],ceph_namespace])|unique|join(",") }}'
replace:
path: "{{ undercloud_conf }}"
regexp: '^(container_insecure_registries\s*=)(.*)'
replace: '\1 {{ reg_list }}'
when:
- defined_insecure_registry.stdout_lines|length != 0
- def_namespace is defined
- full_namespace is defined
- ceph_namespace is defined
- name: adjust existing container_insecure_registries for undercloud upgrade from docker_insecure_registries
vars:
reg_list: '{{ defined_container_registry.stdout.split(",")|union([def_namespace])|union([ceph_namespace])|unique|join(",") }}'
reg_list: '{{ defined_container_registry.stdout.split(",")|union([full_namespace.split("/")[0],ceph_namespace])|unique|join(",") }}'
replace:
path: "{{ undercloud_conf }}"
regexp: '^(container_insecure_registries\s*=)(.*)'
replace: '\1 {{ reg_list }}'
when:
- defined_container_registry.stdout_lines|length != 0
- def_namespace is defined
- full_namespace is defined
- ceph_namespace is defined
- name: remove docker_insecure_registries from undercloud config file if present