Hi all,

I have a playbook with different role sections. Each section runs the same 
role, but with different variables. Now if one role signals a handler to 
restart a service with a variable name, only the first service is restarted.

Let me explain:

This is the handler:

- name: restart service
  service:
    name: "{{ service_name}}"
    state: restarted


So the service name differs per role. So only one service is restarted, the 
first one. Which makes sense, as the handler was already signaled for the 
first occurrence. 

So I was reading and ran into meta: flush_handlers. So I added this at the 
end of a role-run, thinking that Ansible would restart the service, and 
flush the handlers. Well, it did run the handler, but it did not flush it. 
So when the second call was made to the handler, with a different service 
name, it was still just restarting the first service, as it was still in 
the handler.

How can this behavior be changed? I want to restart the service through a 
handler, and then clean the handler before the subsequent roles are 
executed.

Thanks!
Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2ebf4236-b64f-4635-aa9e-790bbf1e67f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to