---
|
# Everything else should use this going forward, combined with a specific set of tasks called by main.yml
|
# to configure the template creation for the specific cloud provider
|
- name: Check if master template exists for the environment
|
stat:
|
path: "../configs/{{ env_type }}/files/cloud_providers/{{cloud_provider}}_cloud_template_master.j2"
|
register: stat_master_template
|
|
- name: Use master template from the environment
|
set_fact:
|
cloud_infra_master_template_src: "../configs/{{ env_type }}/files/cloud_providers/{{cloud_provider}}_cloud_template_master.j2"
|
when: stat_master_template.stat.exists
|
|
- name: Check if nested template exists for the environment
|
stat:
|
path: "../configs/{{ env_type }}/files/cloud_providers/{{cloud_provider}}_cloud_template_nested.j2"
|
register: stat_nested_template
|
|
- name: Use nested template from the environment
|
set_fact:
|
cloud_infra_nested_template_src: "../configs/{{ env_type }}/files/cloud_providers/{{cloud_provider}}_cloud_template_nested.j2"
|
when: stat_nested_template.stat.exists
|
|
- name: Use the default infra template
|
set_fact:
|
cloud_infra_master_template_src: "templates/cloud_template_master.j2"
|
when: not stat_master_template.stat.exists
|
|
- name: Check if default nested template exists
|
stat:
|
path: "templates/cloud_template_nested.j2"
|
register: stat_default_nested_template
|
|
- name: Use the default infra template
|
set_fact:
|
cloud_infra_nested_template_src: "templates/cloud_template_nested.j2"
|
when:
|
- not stat_nested_template.stat.exists
|
- stat_default_nested_template.stat.exists
|
|
- name: Print cloud_infra_template_src
|
debug:
|
var: cloud_infra_master_template_src
|