Pass in list of databases
This commit is contained in:
parent
a5b0cc42a5
commit
f7e6f005f1
@ -1,33 +1,32 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: Run database setup tasks
|
- name: Run database setup tasks
|
||||||
when: db is defined
|
|
||||||
block:
|
block:
|
||||||
- name: Setup database facts
|
- name: Setup database facts
|
||||||
set_fact:
|
set_fact:
|
||||||
mount_map:
|
mount_map:
|
||||||
mariadb: /var/lib/mysql
|
mariadb: /var/lib/mysql
|
||||||
|
|
||||||
- name: "Create {{ db.type }} database"
|
- name: "Create {{ item.type }} database"
|
||||||
no_log: true
|
no_log: true
|
||||||
shell: "
|
shell: "
|
||||||
dokku
|
dokku
|
||||||
{{ db.type }}:create
|
{{ item.type }}:create
|
||||||
{{ app }}
|
{{ app }}
|
||||||
--password {{ db_passwd }}
|
--password {{ item.passwd }}
|
||||||
--root-password {{ root_db_passwd }}
|
--root-password {{ item.root_passwd }}
|
||||||
"
|
"
|
||||||
args:
|
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:
|
dokku_service_link:
|
||||||
app: "{{ app }}"
|
app: "{{ app }}"
|
||||||
name: "{{ app }}"
|
name: "{{ app }}"
|
||||||
service: "{{ db.type }}"
|
service: "{{ item.type }}"
|
||||||
|
|
||||||
- name: "Specify {{ db.type }} volume mounts"
|
- name: "Specify {{ item.type }} volume mounts"
|
||||||
dokku_storage:
|
dokku_storage:
|
||||||
app: "{{ app }}"
|
app: "{{ app }}"
|
||||||
mounts:
|
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
|
- name: Include database tasks
|
||||||
include: ./lib/database.yml
|
include: ./lib/database.yml
|
||||||
|
with_items: "{{ db }}"
|
||||||
|
when: db is defined
|
||||||
|
|
||||||
- name: Include env tasks
|
- name: Include env tasks
|
||||||
include: ./lib/env.yml
|
include: ./lib/env.yml
|
||||||
|
Reference in New Issue
Block a user