---
- 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"
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: "{{ app }}"
name: "{{ app }}"
service: "{{ db.type }}"
- name: "Specify {{ db.type }} volume mounts"
dokku_storage:
mounts:
- "/var/lib/dokku/services/{{ db.type }}/{{ app }}:{{ mount_map[db.type] }}"