Actually, we don't need python at all

This commit is contained in:
Luke Murphy
2020-04-13 11:42:33 +02:00
parent b3e2d08100
commit ded81dab45
12 changed files with 137 additions and 79 deletions

7
plays/lib/config.yml Normal file
View File

@ -0,0 +1,7 @@
---
- name: Load app config into playbook context
include_vars:
dir: "{{ app_config_root }}"
extensions:
- yml
- yaml

25
plays/lib/database.yml Normal file
View File

@ -0,0 +1,25 @@
---
- name: "Create {{ db['type'] }} database"
no_log: true
shell: "
dokku
{{ db['type'] }}:create
{{ app }}
--password {{ db_passwd }}
--root-password {{ root_db_passwd }}
"
args:
creates: "/var/lib/dokku/services/{{ db['type'] }}/{{ app }}"
- name: Link mariadb database to application
dokku_service_link:
app: keycloak
name: keycloak
service: mariadb
- name: Specify mariadb docker volume mounts
dokku_storage:
app: keycloak
mounts:
- /var/lib/dokku/services/mariadb/keycloak:/var/lib/mysql

7
plays/lib/domain.yml Normal file
View File

@ -0,0 +1,7 @@
---
- name: "Configure {{ domain }} domain with Dokku"
dokku_domains:
app: "{{ app }}"
domains:
- "{{ domain }}"
state: present

13
plays/lib/vault.yml Normal file
View File

@ -0,0 +1,13 @@
---
- name: Check if vault variables are available for loading
stat:
path: "{{ app_config_root }}/vault/"
register: vault_dir
- name: Load vault variables into playbook context
include_vars:
dir: "{{ app_config_root }}/vault/"
extensions:
- yml
- yaml
when: vault_dir.stat.exists

27
plays/pre_deploy.yml Normal file
View File

@ -0,0 +1,27 @@
---
- hosts: all
gather_facts: false
tasks:
- name: Include config tasks
include: ./lib/config.yml
- name: Include vault tasks
include: ./lib/vault.yml
- name: Include domain tasks
include: ./lib/domain.yml
- name: Configure the dokku app environment
dokku_config:
app: keycloak
restart: false
config:
DB_ADDR: "dokku-mariadb-keycloak:3306"
DB_DATABASE: "keycloak"
DB_PASSWORD: "{{ db_passwd }}"
DB_USER: "mariadb" # https://github.com/dokku/dokku-mariadb/issues/89
DB_VENDOR: "mariadb"
DOKKU_LETSENCRYPT_EMAIL: "{{ autonomic_admin_mail }}"
KEYCLOAK_PASSWORD: "{{ autonomic_admin_pass }}"
KEYCLOAK_USER: "{{ autonomic_admin_user }}"
PROXY_ADDRESS_FORWARDING: "{{ proxy_address_forwarding }}"

View File

@ -1 +0,0 @@
---