mirror of
				https://github.com/kevinveenbirkenbach/computer-playbook.git
				synced 2025-10-31 18:29:21 +00:00 
			
		
		
		
	Optimized blocks in roles/srv-proxy-6-6-domain/tasks/main.yml
This commit is contained in:
		| @@ -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)" | ||||
|   uri: | ||||
|     url: "{{ domains | get_url(application_id, WEB_PROTOCOL) }}" | ||||
|   register: site_check | ||||
|   failed_when:  false | ||||
|   changed_when: false | ||||
|   when: not nginx_conf.changed | ||||
| - 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 | ||||
|  | ||||
| - 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] | ||||
|     - name: Restart nginx if site is down | ||||
|       command: | ||||
|         cmd: "true" | ||||
|       notify: restart openresty | ||||
|       when: | ||||
|         - site_check.status is defined | ||||
|         - not site_check.status in [200,301,302] | ||||
|   when: not nginx_conf.changed | ||||
		Reference in New Issue
	
	Block a user