Pass in list of databases
This commit is contained in:
parent
a5b0cc42a5
commit
f7e6f005f1
@ -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] }}"
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user