Remove the ternary condition for sova_config

The ternary is failing for some reason, so it is better to avoid the use
of ternary and split the task in two using the when: sova_config_file is
defined or not defined.

Change-Id: Ieb1ebe58608d2445c78942062cd9a82929ffdeb4
This commit is contained in:
Arx Cruz 2021-11-02 13:22:06 +01:00
parent 0b8d481254
commit a1138ea71d
1 changed files with 23 additions and 17 deletions

View File

@ -1,5 +1,6 @@
--- ---
- name: Load sova patterns from URL - block:
- name: Load sova patterns from URL
uri: uri:
url: https://opendev.org/openstack/tripleo-ci-health-queries/raw/branch/master/output/sova-pattern-generated.json url: https://opendev.org/openstack/tripleo-ci-health-queries/raw/branch/master/output/sova-pattern-generated.json
method: GET method: GET
@ -9,16 +10,21 @@
retries: 3 # to avoid accidental failures due to networking or rate limiting retries: 3 # to avoid accidental failures due to networking or rate limiting
delay: 60 delay: 60
register: pattern_config register: pattern_config
- name: Set sova_config from URL content
set_fact:
sova_config: "{{ pattern_config.json }}"
when: sova_config_file is not defined when: sova_config_file is not defined
- name: Load sova patterns from local file - block:
- name: Load sova patterns from local file
command: cat "{{ sova_config_file }}" command: cat "{{ sova_config_file }}"
register: sova_config_file_output register: sova_config_file_output
when: sova_config_file is defined
- name: Set sova_config json content - name: Set sova_config from local file
set_fact: set_fact:
sova_config: "{{ (sova_config_file is defined) | ternary((sova_config_file_output.stdout | from_json), pattern_config.json) }}" sova_config: "{{ sova_config_file_output.stdout | from_json }}"
when: sova_config_file is defined
- name: Run sova task - name: Run sova task
sova: sova: