restart handler: orchestrate
This commit is contained in:
		
							parent
							
								
									a7fbce2990
								
							
						
					
					
						commit
						be582171ce
					
				@ -5,3 +5,23 @@
 | 
				
			|||||||
    enabled: yes
 | 
					    enabled: yes
 | 
				
			||||||
    state: restarted
 | 
					    state: restarted
 | 
				
			||||||
  become: yes
 | 
					  become: yes
 | 
				
			||||||
 | 
					  delegate_to: "{{ ansible_play_hosts | first }}"
 | 
				
			||||||
 | 
					  run_once: True
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- name: "Wait until {{ keycloak.service_name }} becomes active {{ keycloak.health_url }}"
 | 
				
			||||||
 | 
					  ansible.builtin.uri:
 | 
				
			||||||
 | 
					    url: "{{ keycloak.health_url }}"
 | 
				
			||||||
 | 
					  register: keycloak_status
 | 
				
			||||||
 | 
					  until: keycloak_status.status == 200
 | 
				
			||||||
 | 
					  delegate_to: "{{ ansible_play_hosts | first }}"
 | 
				
			||||||
 | 
					  run_once: True
 | 
				
			||||||
 | 
					  retries: 25
 | 
				
			||||||
 | 
					  delay: 10
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- name: "Restart and enable {{ keycloak.service_name }} service"
 | 
				
			||||||
 | 
					  ansible.builtin.systemd:
 | 
				
			||||||
 | 
					    name: keycloak
 | 
				
			||||||
 | 
					    enabled: yes
 | 
				
			||||||
 | 
					    state: restarted
 | 
				
			||||||
 | 
					  become: yes
 | 
				
			||||||
 | 
					  when: and inventory_hostname != ansible_play_hosts | first
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user