Use named inclusion

This commit is contained in:
Luke Murphy 2020-04-14 14:30:50 +02:00
parent 3ffa51b00e
commit 995f06d055
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC

View File

@ -24,6 +24,7 @@
when: config_yml.stat.exists
include_vars:
file: "{{ app_config_root }}/config.yml"
name: "config"
register: config_include
- name: Check if an application vault directory exists
@ -37,6 +38,7 @@
include_vars:
ignore_unknown_extensions: true
dir: "{{ app_config_root }}/vault"
name: "vault"
extensions:
- yml
register: vault_include
@ -53,17 +55,17 @@
- name: Create the vault variable dictionary
set_fact:
vault: "{{ vault_include.ansible_facts }}"
vault: "{{ vault_include.ansible_facts.vault }}"
- name: Create the config variable dictionary
set_fact:
config:
{
"vars": "{{ config_include.ansible_facts.vars | default([]) }}",
"db": "{{ config_include.ansible_facts.db | default([]) }}",
"env": "{{ config_include.ansible_facts.env | default([]) }}",
"volumes": "{{ config_include.ansible_facts.volumes | default([]) }}",
"templates": "{{ config_include.ansible_facts.templates | default([]) }}",
"vars": "{{ config_include.ansible_facts.config.vars | default([]) }}",
"db": "{{ config_include.ansible_facts.config.db | default([]) }}",
"env": "{{ config_include.ansible_facts.config.env | default([]) }}",
"volumes": "{{ config_include.ansible_facts.config.volumes | default([]) }}",
"templates": "{{ config_include.ansible_facts.config.templates | default([]) }}",
}
- name: Debug variable dictionaries
@ -72,5 +74,4 @@
with_items:
- "{{ config }}"
- "{{ dokku }}"
- "{{ vars }}"
when: debug is defined and debug == true