Pass in list of databases

This commit is contained in:
Luke Murphy 2020-04-13 15:57:35 +02:00
parent a5b0cc42a5
commit f7e6f005f1
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
2 changed files with 11 additions and 10 deletions

View File

@ -1,33 +1,32 @@
---
- name: Run database setup tasks
when: db is defined
block:
- name: Setup database facts
set_fact:
mount_map:
mariadb: /var/lib/mysql
- name: "Create {{ db.type }} database"
- name: "Create {{ item.type }} database"
no_log: true
shell: "
dokku
{{ db.type }}:create
{{ item.type }}:create
{{ app }}
--password {{ db_passwd }}
--root-password {{ root_db_passwd }}
--password {{ item.passwd }}
--root-password {{ item.root_passwd }}
"
args:
creates: "/var/lib/dokku/services/{{ db.type }}/{{ app }}"
creates: "/var/lib/dokku/services/{{ item.type }}/{{ app }}"
- name: Link mariadb database to application
- name: "Link {{ db.type }} database to application"
dokku_service_link:
app: "{{ app }}"
name: "{{ app }}"
service: "{{ db.type }}"
service: "{{ item.type }}"
- name: "Specify {{ db.type }} volume mounts"
- name: "Specify {{ item.type }} volume mounts"
dokku_storage:
app: "{{ app }}"
mounts:
- "/var/lib/dokku/services/{{ db.type }}/{{ app }}:{{ mount_map[db.type] }}"
- "/var/lib/dokku/services/{{ item.type }}/{{ app }}:{{ mount_map[item.type] }}"

View File

@ -18,6 +18,8 @@
- name: Include database tasks
include: ./lib/database.yml
with_items: "{{ db }}"
when: db is defined
- name: Include env tasks
include: ./lib/env.yml