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
|
2020-04-14 12:29:37 +00:00
|
|
|
include_vars:
|
2020-04-14 09:30:40 +00:00
|
|
|
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
|
2020-04-14 12:29:37 +00:00
|
|
|
include_vars:
|
2020-04-14 09:30:40 +00:00
|
|
|
file: "{{ app_config_root }}/config.yml"
|
|
|
|
|
|
|
|
- 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
|
2020-04-14 12:29:37 +00:00
|
|
|
include_vars:
|
2020-04-14 09:30:40 +00:00
|
|
|
ignore_unknown_extensions: true
|
|
|
|
dir: "{{ app_config_root }}/vault"
|
2020-04-14 13:06:37 +00:00
|
|
|
name: vault
|
2020-04-14 09:30:40 +00:00
|
|
|
extensions:
|
|
|
|
- yml
|
2020-04-14 13:06:37 +00:00
|
|
|
register: vault_include
|
2020-04-14 11:14:09 +00:00
|
|
|
|
2020-04-14 12:18:37 +00:00
|
|
|
- name: Create the dokku variable dictionary
|
|
|
|
set_fact:
|
|
|
|
dokku:
|
|
|
|
{
|
|
|
|
app: "{{ app }}",
|
|
|
|
mariadb_addr: "dokku-mariadb-{{ app }}",
|
|
|
|
mariadb_user: "mariadb",
|
|
|
|
hostname: "{{ lookup('file', '/home/dokku/HOSTNAME') }}",
|
2020-04-14 13:10:30 +00:00
|
|
|
host: "{{ inventory_hostname }}",
|
2020-04-14 12:18:37 +00:00
|
|
|
}
|
|
|
|
|
2020-04-14 13:06:37 +00:00
|
|
|
# Note(decentral1se): this has to be done like this through the hostvars
|
|
|
|
# interface because of the way Ansible forces us to work here. There is a bug
|
|
|
|
# report out on this: https://github.com/ansible/ansible/issues/36024
|
|
|
|
- name: Create config variable dictionary
|
|
|
|
set_fact:
|
|
|
|
config:
|
2020-04-14 13:10:30 +00:00
|
|
|
db: "{{ hostvars[dokku.host].db | default([]) }}"
|
|
|
|
env: "{{ hostvars[dokku.host].env | default([]) }}"
|
|
|
|
templates: "{{ hostvars[dokku.host].templates | default([]) }}"
|
|
|
|
vars: "{{ hostvars[dokku.host].vars | default([]) }}"
|
|
|
|
volumes: "{{ hostvars[dokku.host].volumes | default([]) }}"
|
2020-04-14 13:06:37 +00:00
|
|
|
|
|
|
|
- name: Create vault variable dictionary
|
|
|
|
set_fact:
|
2020-04-14 13:18:41 +00:00
|
|
|
vault: "{{ vault_include.ansible_facts.vault | default([]) }}"
|