Guillaume Coré
2018-11-28 55d75837bf99ae65a207d7757b038b9dbc9d6226
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
---
- hosts:
    - localhost
    - all
  connection: local
  gather_facts: no
  tags: packer
  tasks:
    - name: stats env_vars.yml and (legacy) env_secret_vars.yml
      stat:
        path: configs/{{ env_type }}/{{ item }}
      loop:
        - env_vars.yml
        - env_secret_vars.yml
      register: rstat_varfiles
 
    - name: Include vars files
      include_vars:
        file: "{{ item.stat.path }}"
      when: item.stat.exists
      loop: "{{ rstat_varfiles.results }}"
      loop_control:
        label: "{{ item._ansible_item_label | default(item) }}"
 
    - name: Set output_dir for all hosts
      set_fact:
        output_dir: "{{ hostvars.localhost.output_dir }}"
      when: hostvars.localhost.output_dir is defined