Guillaume Coré
2020-03-11 1d970fbaa4bd88c9d094d9587db59fdf9cd0239a
commit | author | age
6b9f19 1 ---
NS 2 # Everything else should use this going forward, combined with a specific set of tasks called by main.yml
3 # to configure the template creation for the specific cloud provider
4 - name: Check if master template exists for the environment
5   stat:
6     path: "../configs/{{ env_type }}/files/cloud_providers/{{cloud_provider}}_cloud_template_master.j2"
7   register: stat_master_template
8
9 - name: Use master template from the environment
10   set_fact:
11     cloud_infra_master_template_src: "../configs/{{ env_type }}/files/cloud_providers/{{cloud_provider}}_cloud_template_master.j2"
12   when: stat_master_template.stat.exists
13
14 - name: Check if nested template exists for the environment
15   stat:
16     path: "../configs/{{ env_type }}/files/cloud_providers/{{cloud_provider}}_cloud_template_nested.j2"
17   register: stat_nested_template
18
19 - name: Use nested template from the environment
20   set_fact:
21     cloud_infra_nested_template_src: "../configs/{{ env_type }}/files/cloud_providers/{{cloud_provider}}_cloud_template_nested.j2"
22   when: stat_nested_template.stat.exists
23
d84223 24 - name: Use the default infra template
GC 25   set_fact:
26     cloud_infra_master_template_src: "templates/cloud_template_master.j2"
27   when: not stat_master_template.stat.exists
6b9f19 28
d84223 29 - name: Check if default nested template exists
GC 30   stat:
31     path: "templates/cloud_template_nested.j2"
32   register: stat_default_nested_template
33
34 - name: Use the default infra template
35   set_fact:
36     cloud_infra_nested_template_src: "templates/cloud_template_nested.j2"
37   when:
38     - not stat_nested_template.stat.exists
39     - stat_default_nested_template.stat.exists
6b9f19 40
NS 41 - name: Print cloud_infra_template_src
42   debug:
43     var: cloud_infra_master_template_src