31 lines
		
	
	
		
			956 B
		
	
	
	
		
			YAML
		
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			956 B
		
	
	
	
		
			YAML
		
	
	
| ---
 | |
| 
 | |
| - name: restart nginx
 | |
|   debug: msg="checking config first"
 | |
|   changed_when: True
 | |
|   notify:
 | |
|     - check nginx configuration
 | |
|     - restart nginx - after config check
 | |
| 
 | |
| - name: reload nginx
 | |
|   debug: msg="checking config first"
 | |
|   changed_when: True
 | |
|   notify:
 | |
|     - check nginx configuration
 | |
|     - reload nginx - after config check
 | |
| 
 | |
| - name: check nginx configuration
 | |
|   command: "{{ nginx_binary_name }} -t"
 | |
|   register: result
 | |
|   changed_when: "result.rc != 0"
 | |
|   check_mode: no
 | |
|   when: nginx_installation_type in nginx_installation_types_using_service
 | |
| 
 | |
| - name: restart nginx - after config check
 | |
|   service: name={{ nginx_service_name }} state=restarted
 | |
|   when: nginx_installation_type in nginx_installation_types_using_service and nginx_daemon_mode == "on"
 | |
| 
 | |
| - name: reload nginx - after config check
 | |
|   service: name={{ nginx_service_name }} state=reloaded
 | |
|   when: nginx_installation_type in nginx_installation_types_using_service and nginx_daemon_mode == "on"
 |