Move to dictionary vars strategy

This commit is contained in:
Luke Murphy
2020-04-14 13:44:09 +02:00
parent 618ae495b2
commit 5e9cc84e8b
10 changed files with 43 additions and 41 deletions

View File

@ -1,9 +1,10 @@
---
- name: Set database facts
no_log: true
set_fact:
mount_map:
mariadb: /var/lib/mysql
when: db is defined
when: config.db
- name: "Create {{ item.type }} database"
no_log: true
@ -16,8 +17,8 @@
"
args:
creates: "/var/lib/dokku/services/{{ item.type }}/{{ dokku.app }}"
with_items: "{{ db }}"
when: db is defined
with_items: "{{ config.db }}"
when: config.db
- name: "Link {{ item.type }} database to application"
no_log: true
@ -25,13 +26,14 @@
app: "{{ dokku.app }}"
name: "{{ dokku.app }}"
service: "{{ item.type }}"
with_items: "{{ db }}"
when: db is defined
with_items: "{{ config.db }}"
when: config.db
- name: "Specify {{ item.type }} volume mounts"
no_log: true
dokku_storage:
app: "{{ dokku.app }}"
mounts:
- "/var/lib/dokku/services/{{ item.type }}/{{ dokku.app }}:{{ mount_map[item.type] }}"
with_items: "{{ db }}"
when: db is defined
with_items: "{{ config.db }}"
when: config.db