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