This repository has been archived on 2020-05-07. You can view files and clone it, but cannot push or open issues or pull requests.
dokku-ansible-deploy/plays/predeploy/lib/database.yml

41 lines
922 B
YAML
Raw Normal View History

2020-04-13 09:42:33 +00:00
---
- name: Set database facts
2020-04-14 11:44:09 +00:00
no_log: true
set_fact:
mount_map:
mariadb: /var/lib/mysql
mongo: /var/lib/mongo
2020-04-14 11:44:09 +00:00
when: config.db
- name: Create database
no_log: true
shell: "
dokku
{{ item.type }}:create
2020-04-14 11:02:16 +00:00
{{ dokku.app }}
--password {{ item.passwd }}
--root-password {{ item.root_passwd }}
"
args:
2020-04-14 11:02:16 +00:00
creates: "/var/lib/dokku/services/{{ item.type }}/{{ dokku.app }}"
2020-04-14 11:44:09 +00:00
with_items: "{{ config.db }}"
when: config.db
2020-04-13 09:42:33 +00:00
- name: Link database to application
2020-04-14 11:22:38 +00:00
no_log: true
dokku_service_link:
2020-04-14 11:02:16 +00:00
app: "{{ dokku.app }}"
name: "{{ dokku.app }}"
service: "{{ item.type }}"
2020-04-14 11:44:09 +00:00
with_items: "{{ config.db }}"
when: config.db
2020-04-13 13:02:55 +00:00
- name: Specify volume mounts
2020-04-14 11:44:09 +00:00
no_log: true
dokku_storage:
2020-04-14 11:02:16 +00:00
app: "{{ dokku.app }}"
mounts:
2020-04-14 11:02:16 +00:00
- "/var/lib/dokku/services/{{ item.type }}/{{ dokku.app }}:{{ mount_map[item.type] }}"
2020-04-14 11:44:09 +00:00
with_items: "{{ config.db }}"
when: config.db