mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-15 16:40:45 +02:00
Refactored handlers loading
This commit is contained in:
parent
aae69ea15b
commit
22c8c395f0
@ -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 }}"
|
dest: "{{ nginx.files.configuration }}"
|
||||||
notify: restart openresty
|
notify: restart openresty
|
||||||
|
|
||||||
- name: flush nginx service
|
- include_tasks: utils/run_once.yml
|
||||||
meta: flush_handlers
|
|
||||||
|
|
||||||
- name: run {{ role_name }} once
|
|
||||||
set_fact:
|
|
||||||
run_once_srv_web_7_4_core: true
|
|
||||||
when: run_once_srv_web_7_4_core is not defined
|
when: run_once_srv_web_7_4_core is not defined
|
||||||
|
@ -25,8 +25,9 @@
|
|||||||
- include_tasks: utils/run_once.yml
|
- include_tasks: utils/run_once.yml
|
||||||
when: run_once_svc_db_postgres is not defined
|
when: run_once_svc_db_postgres is not defined
|
||||||
|
|
||||||
- name: "Ensure that {{ docker_compose.directories.instance }} is up"
|
- include_tasks: "{{ playbook_dir }}/tasks/utils/load_handlers.yml"
|
||||||
include_tasks: "{{ playbook_dir }}/roles/docker-compose/tasks/helpers/ensure.yml"
|
vars:
|
||||||
|
handler_role_name: "docker-compose"
|
||||||
|
|
||||||
- name: "Initialize database for '{{ database_name }}'"
|
- name: "Initialize database for '{{ database_name }}'"
|
||||||
include_tasks: init.yml
|
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
|
@ -1,23 +1,22 @@
|
|||||||
---
|
---
|
||||||
|
- block:
|
||||||
|
|
||||||
- name: "include role for {{application_id}} to receive certs & do modification routines"
|
- name: "include role for {{application_id}} to receive certs & do modification routines"
|
||||||
include_role:
|
include_role:
|
||||||
name: srv-web-7-6-composer
|
name: srv-web-7-6-composer
|
||||||
vars:
|
vars:
|
||||||
domain: "{{ domains | get_domain(application_id) }}"
|
domain: "{{ domains | get_domain(application_id) }}"
|
||||||
http_port: "{{ ports.localhost.http[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"
|
- name: "generate {{domains | get_domain(application_id)}}.conf"
|
||||||
template:
|
template:
|
||||||
src: "nginx.conf.j2"
|
src: "nginx.conf.j2"
|
||||||
dest: "{{ nginx.directories.http.servers }}{{ domains | get_domain(application_id) }}.conf"
|
dest: "{{ nginx.directories.http.servers }}{{ domains | get_domain(application_id) }}.conf"
|
||||||
notify: restart openresty
|
notify: restart openresty
|
||||||
|
|
||||||
|
- include_tasks: utils/run_once.yml
|
||||||
when: run_once_web_svc_cdn is not defined
|
when: run_once_web_svc_cdn is not defined
|
||||||
|
|
||||||
- name: run the web svc cdn tasks once
|
- include_tasks: "{{ playbook_dir }}/tasks/utils/load_handlers.yml"
|
||||||
set_fact:
|
vars:
|
||||||
run_once_web_svc_cdn: true
|
handler_role_name: "docker-compose"
|
||||||
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"
|
|
||||||
|
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