[ffwd3][update] Improve ovn update

To ensure we get the right config we now use config_patterns.
Also to find ovn config file we use find to pick on all
ovn_controller.json. This should help with upgrade case when
the config is hashed-ovn_controller.json. Lastly if we use
config_patterns we need to pass image override also as an
pattern.

Resolves: rhbz#2243277
Depends-On: I33a5b4d9b6335ae07f84c4f9f0c7629ed6bd6180
Change-Id: Ie729fd31d6a09f661e7c5e7df8435ff2ebdad3b4
This commit is contained in:
Lukas Bezdicka 2023-09-21 11:40:22 +02:00 committed by Lukas Bezdicka
parent 03c1758ac5
commit ae26d54a4c

@ -612,18 +612,25 @@ outputs:
any_ovn_host: "{{groups['ovn_controller'] | difference(groups['excluded_overcloud']) | first }}"
tags: ovn
when: step|int == 1
- name: Infer if we're coming from 17.0
stat:
path: /var/lib/tripleo-config/container-startup-config/step_4/ovn_controller.json
- name: Find ovn_controller configs in container-startup-configs
find:
paths: /var/lib/tripleo-config/container-startup-config/
patterns: "*ovn_controller.json"
recurse: yes
register: ovn_cont_17_0
delegate_to: "{{ any_ovn_host }}"
when: (step|int == 1) and (any_ovn_host is defined) and (any_ovn_host|length > 0)
tags:
- ovn
become: true
- name: get directory path from the ovn_cont_17_0
set_fact:
ovn_config_path: "{{ ovn_cont_17_0.files.0.path | dirname }}"
when: step|int == 1
tags: ovn
- name: Update ovn_controller.
vars:
config_step: "{{ ((ovn_cont_17_0 is defined) and ovn_cont_17_0.stat.exists) | ternary('4', '3')}}"
config_step: "{{ ('step_4' in ovn_config_path) | ternary('4', '3')}}"
when: step|int == 1
tags: ovn
become: true
@ -633,15 +640,16 @@ outputs:
poll: 0
register: ovn_controller_update
tripleo_container_manage:
config_dir: "/var/lib/tripleo-config/container-startup-config/step_{{ config_step }}"
config_patterns: 'ovn_controller.json'
config_dir: "{{ ovn_config_path }}"
config_patterns: '*ovn_controller.json'
config_id:
- 'tripleo_step{{config_step}}'
log_base_path: "{{ container_log_stdout_path }}"
debug: "{{ enable_debug | bool }}"
config_overrides:
ovn_controller:
'.*ovn_controller':
image: {get_param: ContainerOvnControllerConfigImage}
name: "ovn_controller"
- name: Was the ovn_controller successful.
when:
- step|int == 1