Optimized blocks in roles/srv-proxy-6-6-domain/tasks/main.yml

This commit is contained in:
Kevin Veen-Birkenbach 2025-08-10 18:31:12 +02:00
parent 77816ac4e7
commit f5659a44f8
No known key found for this signature in database
GPG Key ID: 44D8F11FD62F878E

View File

@ -1,7 +1,6 @@
# run_once_srv_proxy_6_6_domain: deactivated
- block:
- include_tasks: "01_cloudflare.yml"
- include_tasks: "01_cloudflare.yml"
when: dns_provider == "cloudflare"
- include_tasks: "{{ playbook_dir }}/tasks/utils/load_handlers.yml"
@ -19,19 +18,19 @@
register: nginx_conf
notify: restart openresty
- name: "Check if {{ domains | get_domain(application_id) }} is reachable (only if config unchanged)"
- block:
- name: "Check if {{ domains | get_domain(application_id) }} is reachable (only if config unchanged)"
uri:
url: "{{ domains | get_url(application_id, WEB_PROTOCOL) }}"
register: site_check
failed_when: false
changed_when: false
when: not nginx_conf.changed
- name: Restart nginx if site is down
- name: Restart nginx if site is down
command:
cmd: "true"
notify: restart openresty
when:
- not nginx_conf.changed
- site_check.status is defined
- not site_check.status in [200,301,302]
when: not nginx_conf.changed