mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-15 08:30:46 +02:00
Refactored handlers loading
This commit is contained in:
parent
aae69ea15b
commit
22c8c395f0
@ -7,8 +7,8 @@
|
||||
- name: "For '{{ application_id }}': Load database variables"
|
||||
include_vars: "{{ item }}"
|
||||
loop:
|
||||
- "{{ DOCKER_VARS_FILE }}" # Important to load docker variables first so that database can use them
|
||||
- "{{ cmp_db_docker_vars_file_db }}" # Important to load them before docker role so that backup can use them
|
||||
- "{{ DOCKER_VARS_FILE }}" # Important to load docker variables first so that database can use them
|
||||
- "{{ cmp_db_docker_vars_file_db }}" # Important to load them before docker role so that backup can use them
|
||||
|
||||
- name: "For '{{ application_id }}': Load cmp-docker-oauth2"
|
||||
include_role:
|
||||
|
@ -1,5 +0,0 @@
|
||||
- name: "Load handlers without when condition. to guaranty that they are executed"
|
||||
import_role:
|
||||
name: docker-compose
|
||||
tasks_from: helpers/none
|
||||
handlers_from: main
|
@ -49,10 +49,5 @@
|
||||
dest: "{{ nginx.files.configuration }}"
|
||||
notify: restart openresty
|
||||
|
||||
- name: flush nginx service
|
||||
meta: flush_handlers
|
||||
|
||||
- name: run {{ role_name }} once
|
||||
set_fact:
|
||||
run_once_srv_web_7_4_core: true
|
||||
- include_tasks: utils/run_once.yml
|
||||
when: run_once_srv_web_7_4_core is not defined
|
||||
|
@ -25,8 +25,9 @@
|
||||
- include_tasks: utils/run_once.yml
|
||||
when: run_once_svc_db_postgres is not defined
|
||||
|
||||
- name: "Ensure that {{ docker_compose.directories.instance }} is up"
|
||||
include_tasks: "{{ playbook_dir }}/roles/docker-compose/tasks/helpers/ensure.yml"
|
||||
- include_tasks: "{{ playbook_dir }}/tasks/utils/load_handlers.yml"
|
||||
vars:
|
||||
handler_role_name: "docker-compose"
|
||||
|
||||
- name: "Initialize database for '{{ database_name }}'"
|
||||
include_tasks: init.yml
|
||||
|
1
roles/svc-prx-openresty/tasks/none.yml
Normal file
1
roles/svc-prx-openresty/tasks/none.yml
Normal file
@ -0,0 +1 @@
|
||||
# Dummy file for handler import
|
@ -62,4 +62,4 @@
|
||||
notify: docker compose up
|
||||
|
||||
- include_tasks: utils/run_once.yml
|
||||
when: run_once_web_app_port_ui is not defined
|
||||
when: run_once_web_app_port_ui is not defined
|
@ -1,23 +1,22 @@
|
||||
---
|
||||
- name: "include role for {{application_id}} to receive certs & do modification routines"
|
||||
include_role:
|
||||
name: srv-web-7-6-composer
|
||||
- block:
|
||||
|
||||
- name: "include role for {{application_id}} to receive certs & do modification routines"
|
||||
include_role:
|
||||
name: srv-web-7-6-composer
|
||||
vars:
|
||||
domain: "{{ domains | get_domain(application_id) }}"
|
||||
http_port: "{{ ports.localhost.http[application_id] }}"
|
||||
|
||||
- name: "generate {{domains | get_domain(application_id)}}.conf"
|
||||
template:
|
||||
src: "nginx.conf.j2"
|
||||
dest: "{{ nginx.directories.http.servers }}{{ domains | get_domain(application_id) }}.conf"
|
||||
notify: restart openresty
|
||||
|
||||
- include_tasks: utils/run_once.yml
|
||||
when: run_once_web_svc_cdn is not defined
|
||||
|
||||
- include_tasks: "{{ playbook_dir }}/tasks/utils/load_handlers.yml"
|
||||
vars:
|
||||
domain: "{{ domains | get_domain(application_id) }}"
|
||||
http_port: "{{ ports.localhost.http[application_id] }}"
|
||||
when: run_once_web_svc_cdn is not defined
|
||||
|
||||
- name: "generate {{domains | get_domain(application_id)}}.conf"
|
||||
template:
|
||||
src: "nginx.conf.j2"
|
||||
dest: "{{ nginx.directories.http.servers }}{{ domains | get_domain(application_id) }}.conf"
|
||||
notify: restart openresty
|
||||
when: run_once_web_svc_cdn is not defined
|
||||
|
||||
- name: run the web svc cdn tasks once
|
||||
set_fact:
|
||||
run_once_web_svc_cdn: true
|
||||
when: run_once_web_svc_cdn is not defined
|
||||
|
||||
- name: "Ensure that {{ docker_compose.directories.instance }} is up"
|
||||
include_tasks: "{{ playbook_dir }}/roles/docker-compose/tasks/helpers/ensure.yml"
|
||||
handler_role_name: "docker-compose"
|
||||
|
5
tasks/utils/load_handlers.yml
Normal file
5
tasks/utils/load_handlers.yml
Normal file
@ -0,0 +1,5 @@
|
||||
- name: "Load pure handlers from '{{ handler_role_name }}' without 'when' to guaranty that they are executed"
|
||||
import_role:
|
||||
name: "{{ handler_role_name }}"
|
||||
tasks_from: "none.yml"
|
||||
handlers_from: main
|
Loading…
x
Reference in New Issue
Block a user