Drop debug, names and use with_items for db tasks

This commit is contained in:
Luke Murphy 2020-04-14 11:13:06 +02:00
parent 878b1df3b4
commit 584360421b
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
5 changed files with 41 additions and 90 deletions

View File

@ -1,31 +1,32 @@
---
- name: Run database setup tasks
block:
- name: Set database facts
set_fact:
mount_map:
mariadb: /var/lib/mysql
- name: Set database facts
set_fact:
mount_map:
mariadb: /var/lib/mysql
- name: "Create {{ store.type }} database"
no_log: true
shell: "
dokku
{{ store.type }}:create
{{ app }}
--password {{ store.passwd }}
--root-password {{ store.root_passwd }}
"
args:
creates: "/var/lib/dokku/services/{{ store.type }}/{{ app }}"
- 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 }}"
with_items: "{{ db }}"
- name: "Link {{ store.type }} database to application"
dokku_service_link:
app: "{{ app }}"
name: "{{ app }}"
service: "{{ store.type }}"
- name: "Link {{ item.type }} database to application"
dokku_service_link:
app: "{{ app }}"
name: "{{ app }}"
service: "{{ item.type }}"
with_items: "{{ db }}"
- name: "Specify {{ store.type }} volume mounts"
dokku_storage:
app: "{{ app }}"
mounts:
- "/var/lib/dokku/services/{{ store.type }}/{{ app }}:{{ mount_map[store.type] }}"
- name: "Specify {{ item.type }} volume mounts"
dokku_storage:
app: "{{ app }}"
mounts:
- "/var/lib/dokku/services/{{ item.type }}/{{ app }}:{{ mount_map[item.type] }}"
with_items: "{{ db }}"

View File

@ -1,5 +0,0 @@
---
- name: Debug all variables
debug:
msg: "{{ vars }}"
when: debug

View File

@ -2,23 +2,12 @@
- hosts: all
gather_facts: false
tasks:
- name: Include prepare tasks
include: ./lib/prepare.yml
- name: Include vars tasks
include: ./lib/vars.yml
# Note(decentral1se): internal debugging. Please `debug: true` in the
# /var/lib/dokku/data/deploy.d/vars.yml file to activate a debug vars dump
- name: Include debug tasks
include: ./lib/debug.yml
when: debug is defined
- include: ./lib/prepare.yml
- include: ./lib/vars.yml
- name: Remove deploy.d folder
file:
path: "{{ app_config_root }}"
state: absent
- name: Remove database(s)
shell: "dokku {{ item.type }}:destroy {{ app }} --force"
args:

View File

@ -2,23 +2,8 @@
- hosts: all
gather_facts: false
tasks:
- name: Include prepare tasks
include: ./lib/prepare.yml
- name: Include vars tasks
include: ./lib/vars.yml
# Note(decentral1se): internal debugging. Please `debug: true` in the
# /var/lib/dokku/data/deploy.d/vars.yml file to activate a debug vars dump
- name: Include debug tasks
include: ./lib/debug.yml
when: debug is defined
- name: Include http tasks
include: ./lib/http.yml
- name: Include https tasks
include: ./lib/https.yml
- name: Include proxy tasks
include: ./lib/proxy.yml
- include: ./lib/prepare.yml
- include: ./lib/vars.yml
- include: ./lib/http.yml
- include: ./lib/https.yml
- include: ./lib/proxy.yml

View File

@ -2,28 +2,9 @@
- hosts: all
gather_facts: false
tasks:
- name: Include prepare tasks
include: ./lib/prepare.yml
- name: Include vars tasks
include: ./lib/vars.yml
# Note(decentral1se): internal debugging. Please `debug: true` in the
# /var/lib/dokku/data/deploy.d/vars.yml file to activate a debug vars dump
- name: Include debug tasks
include: ./lib/debug.yml
when: debug is defined
- name: Include domain tasks
include: ./lib/domain.yml
- name: Include database tasks
include: ./lib/database.yml store={{ item }}
with_items: "{{ db }}"
when: db is defined
- name: Include volume tasks
include: ./lib/volumes.yml
- name: Include env tasks
include: ./lib/env.yml
- include: ./lib/prepare.yml
- include: ./lib/vars.yml
- include: ./lib/domain.yml
- include: ./lib/database.yml
- include: ./lib/volumes.yml
- include: ./lib/env.yml