2020-04-14 09:30:40 +00:00
|
|
|
---
|
2020-04-14 11:02:16 +00:00
|
|
|
# Note(decentral1se): please note that the majority of the vars that are
|
|
|
|
# referenced in this play are passed in via --extra-vars definitions in the
|
|
|
|
# functions script
|
|
|
|
|
2020-04-14 09:30:40 +00:00
|
|
|
- name: Check if internal system variables exists
|
|
|
|
stat:
|
|
|
|
path: "{{ plugin_config_root }}/vars.yml"
|
|
|
|
register: vars_yml
|
|
|
|
|
|
|
|
- name: Load internal system variables
|
|
|
|
no_log: true
|
|
|
|
when: vars_yml.stat.exists
|
|
|
|
include_vars:
|
|
|
|
file: "{{ plugin_config_root }}/vars.yml"
|
|
|
|
|
|
|
|
- name: Check if the application config file exists
|
|
|
|
stat:
|
|
|
|
path: "{{ app_config_root }}/config.yml"
|
|
|
|
register: config_yml
|
|
|
|
|
|
|
|
- name: Load unencrypted configuration variables
|
|
|
|
no_log: true
|
|
|
|
when: config_yml.stat.exists
|
|
|
|
include_vars:
|
|
|
|
file: "{{ app_config_root }}/config.yml"
|
2020-04-14 12:09:22 +00:00
|
|
|
register: config_include
|
2020-04-14 09:30:40 +00:00
|
|
|
|
|
|
|
- name: Check if an application vault directory exists
|
|
|
|
stat:
|
|
|
|
path: "{{ app_config_root }}/vault"
|
|
|
|
register: vault_dir
|
|
|
|
|
|
|
|
- name: Load application encrypted vault variables
|
|
|
|
no_log: true
|
|
|
|
when: vault_dir.stat.exists
|
|
|
|
include_vars:
|
|
|
|
ignore_unknown_extensions: true
|
|
|
|
dir: "{{ app_config_root }}/vault"
|
|
|
|
extensions:
|
|
|
|
- yml
|
2020-04-14 11:14:09 +00:00
|
|
|
register: vault_include
|
|
|
|
|
2020-04-14 11:44:09 +00:00
|
|
|
- name: Create the variable dictionaries
|
2020-04-14 11:14:09 +00:00
|
|
|
set_fact:
|
2020-04-14 11:44:09 +00:00
|
|
|
config:
|
|
|
|
{
|
2020-04-14 12:09:22 +00:00
|
|
|
"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([]) }}",
|
2020-04-14 11:47:26 +00:00
|
|
|
"vault": "{{ vault_include.ansible_facts }}",
|
2020-04-14 11:44:09 +00:00
|
|
|
}
|
|
|
|
dokku:
|
|
|
|
{
|
|
|
|
app: "{{ app }}",
|
|
|
|
mariadb_addr: "dokku-mariadb-{{ app }}",
|
|
|
|
mariadb_user: "mariadb",
|
|
|
|
hostname: "{{ lookup('file', '/home/dokku/HOSTNAME') }}",
|
|
|
|
}
|
2020-04-14 11:53:32 +00:00
|
|
|
|
|
|
|
- name: Debug variable dictionaries
|
|
|
|
debug:
|
|
|
|
msg: "{{ item }}"
|
|
|
|
with_items:
|
|
|
|
- "{{ config }}"
|
|
|
|
- "{{ dokku }}"
|
2020-04-14 11:58:46 +00:00
|
|
|
- "{{ vars }}"
|
2020-04-14 11:53:32 +00:00
|
|
|
when: debug is defined and debug == true
|