Merge "Setting default inventory to 0 length string"

This commit is contained in:
Zuul 2022-05-10 01:13:03 +00:00 committed by Gerrit Code Review
commit e6d44f4dff
2 changed files with 9 additions and 5 deletions

View File

@ -5,7 +5,7 @@ zuul_work_virtualenv: "{{ user_dir }}/.venv"
vf_log_dir: "{{ ansible_user_dir }}/logs"
ansible_dir: ""
inventory: "localhost"
inventory: ""
inventory_list:
- '{{ user_dir }}/tripleo-deploy/overcloud/tripleo-ansible-inventory.yaml'
- '{{ user_dir }}/tripleo-deploy/undercloud/tripleo-ansible-inventory.yaml'

View File

@ -48,19 +48,23 @@
- name: Stat all possible inventory location
register: stat_results
stat:
path: '{{ item }}'
path: '{{ inv_path }}'
loop: '{{ inventory_list }}'
loop_control:
loop_var: inv_path
- name: Set inventory path or fallback to default localhost
set_fact:
inventory_path: '{{ item.item if not inventory_path|default(false) else inventory_path|default("localhost") }}'
inventory_path: '{{ stat_result.inv_path }}'
when:
- '{{ item.stat.exists }}'
- '{{ stat_result.stat.exists }}'
loop: '{{ stat_results.results }}'
loop_control:
loop_var: stat_result
- name: Set inventory variable
set_fact:
inventory: '{{ inventory_path }}'
inventory: '{{ inventory_path|default("localhost") }}'
when: inventory == ""
- name: Run positive validation tests