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