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 - name: Set database facts
block: set_fact:
- name: Set database facts mount_map:
set_fact: mariadb: /var/lib/mysql
mount_map:
mariadb: /var/lib/mysql
- name: "Create {{ store.type }} database" - name: "Create {{ item.type }} database"
no_log: true no_log: true
shell: " shell: "
dokku dokku
{{ store.type }}:create {{ item.type }}:create
{{ app }} {{ app }}
--password {{ store.passwd }} --password {{ item.passwd }}
--root-password {{ store.root_passwd }} --root-password {{ item.root_passwd }}
" "
args: args:
creates: "/var/lib/dokku/services/{{ store.type }}/{{ app }}" creates: "/var/lib/dokku/services/{{ item.type }}/{{ app }}"
with_items: "{{ db }}"
- name: "Link {{ store.type }} database to application" - name: "Link {{ item.type }} database to application"
dokku_service_link: dokku_service_link:
app: "{{ app }}" app: "{{ app }}"
name: "{{ app }}" name: "{{ app }}"
service: "{{ store.type }}" service: "{{ item.type }}"
with_items: "{{ db }}"
- name: "Specify {{ store.type }} volume mounts" - name: "Specify {{ item.type }} volume mounts"
dokku_storage: dokku_storage:
app: "{{ app }}" app: "{{ app }}"
mounts: mounts:
- "/var/lib/dokku/services/{{ store.type }}/{{ app }}:{{ mount_map[store.type] }}" - "/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 - hosts: all
gather_facts: false gather_facts: false
tasks: tasks:
- name: Include prepare tasks - include: ./lib/prepare.yml
include: ./lib/prepare.yml - include: ./lib/vars.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: Remove deploy.d folder - name: Remove deploy.d folder
file: file:
path: "{{ app_config_root }}" path: "{{ app_config_root }}"
state: absent state: absent
- name: Remove database(s) - name: Remove database(s)
shell: "dokku {{ item.type }}:destroy {{ app }} --force" shell: "dokku {{ item.type }}:destroy {{ app }} --force"
args: args:

View File

@ -2,23 +2,8 @@
- hosts: all - hosts: all
gather_facts: false gather_facts: false
tasks: tasks:
- name: Include prepare tasks - include: ./lib/prepare.yml
include: ./lib/prepare.yml - include: ./lib/vars.yml
- include: ./lib/http.yml
- name: Include vars tasks - include: ./lib/https.yml
include: ./lib/vars.yml - include: ./lib/proxy.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

View File

@ -2,28 +2,9 @@
- hosts: all - hosts: all
gather_facts: false gather_facts: false
tasks: tasks:
- name: Include prepare tasks - include: ./lib/prepare.yml
include: ./lib/prepare.yml - include: ./lib/vars.yml
- include: ./lib/domain.yml
- name: Include vars tasks - include: ./lib/database.yml
include: ./lib/vars.yml - include: ./lib/volumes.yml
- include: ./lib/env.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