This repository has been archived on 2020-05-07. You can view files and clone it, but cannot push or open issues or pull requests.
dokku-ansible-deploy/plays/commonlib/vars.yml
2020-04-14 14:30:50 +02:00

78 lines
2.1 KiB
YAML

---
# 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
- 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"
name: "config"
register: config_include
- 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"
name: "vault"
extensions:
- yml
register: vault_include
- 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') }}",
}
- name: Create the vault variable dictionary
set_fact:
vault: "{{ vault_include.ansible_facts.vault }}"
- name: Create the config variable dictionary
set_fact:
config:
{
"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
debug:
msg: "{{ item }}"
with_items:
- "{{ config }}"
- "{{ dokku }}"
when: debug is defined and debug == true