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,24 +1,30 @@
---
- name: Load sova patterns from URL
uri:
url: https://opendev.org/openstack/tripleo-ci-health-queries/raw/branch/master/output/sova-pattern-generated.json
method: GET
return_content: true
status_code: 200
body_format: json
retries: 3 # to avoid accidental failures due to networking or rate limiting
delay: 60
register: pattern_config
- block:
- name: Load sova patterns from URL
uri:
url: https://opendev.org/openstack/tripleo-ci-health-queries/raw/branch/master/output/sova-pattern-generated.json
method: GET
return_content: true
status_code: 200
body_format: json
retries: 3 # to avoid accidental failures due to networking or rate limiting
delay: 60
register: pattern_config
- name: Set sova_config from URL content
set_fact:
sova_config: "{{ pattern_config.json }}"
when: sova_config_file is not defined
- name: Load sova patterns from local file
command: cat "{{ sova_config_file }}"
register: sova_config_file_output
when: sova_config_file is defined
- block:
- name: Load sova patterns from local file
command: cat "{{ sova_config_file }}"
register: sova_config_file_output
- name: Set sova_config json content
set_fact:
sova_config: "{{ (sova_config_file is defined) | ternary((sova_config_file_output.stdout | from_json), pattern_config.json) }}"
- name: Set sova_config from local file
set_fact:
sova_config: "{{ sova_config_file_output.stdout | from_json }}"
when: sova_config_file is defined
- name: Run sova task
sova: