---
|
- hosts:
|
- localhost
|
- all
|
connection: local
|
gather_facts: no
|
tags: include_vars
|
tasks:
|
- name: Set output_dir for all hosts
|
set_fact:
|
output_dir: "{{ hostvars.localhost.output_dir }}"
|
when: hostvars.localhost.output_dir is defined
|
|
- name: stats env_vars.yml and (legacy) env_secret_vars.yml
|
stat:
|
path: "{{ item }}"
|
loop:
|
- configs/{{ env_type }}/env_vars.yml
|
- cloud_providers/{{ cloud_provider }}_default_vars.yml
|
- configs/{{ env_type }}/env_secret_vars.yml
|
- "{{ secret_file | d('/secret/file/not/passed') }}"
|
register: rstat_varfiles
|
|
- name: Include vars files
|
include_vars:
|
file: "{{ item.stat.path }}"
|
when:
|
- item is not skipped
|
- item.stat.exists
|
loop: "{{ rstat_varfiles.results }}"
|
loop_control:
|
label: >-
|
{{ (
|
item.stat.path
|
| default(item._ansible_item_label)
|
| default(item)
|
) if 'stat' in item else item }}
|