Hi James,
I have a doubt on your comment, Ansible runs playbook in order A,B,C for 
example and server B is a master server for example. How ansible runs shut 
down on C before B? It actually goes order A,B,C. Do you mean put the 
mentioned tasks in handler or tasks? I completely dint not get how we 
achieve this. Please give me some more details on this. Thanks. 

On Friday, May 2, 2014 at 5:33:01 PM UTC+2, James Cammarata wrote:
>
> To handle this, I would create a custom fact (
> http://docs.ansible.com/playbooks_variables.html#local-facts-facts-d) 
> that returned whether the current host is in the master state. Then you 
> could write two tasks as follows:
>
> - name: shut down non-masters
>   # <- whatever method you're using to shut things down, ie. service, etc.
>   when: not ansible_local.master_status.is_master
>
> - name: shut down the master last
>   # <- whatever method you're using to shut things down, ie. service, etc.
>   when: ansible_local.master_status.is_master
>
> Assuming the local fact was named "master_status.fact" and it returned 
> JSON like {'is_master': true}.
>
>
>
> On Fri, May 2, 2014 at 10:05 AM, nfwlpw <nfw...@gmail.com <javascript:>> 
> wrote:
>
>> This might be a newbie question, but I can't figure out how to without 
>> writing a wrapper around ansible, or invoking ansible multiple times
>>
>> Let's say this is my inventory:
>>
>> [some_service]
>> A
>> B
>> C
>>
>> Some_service runs in synchronization mode so one is the master, which 
>> need to be shut down last.
>>
>> The trouble is I do not know without actually running "some_command" 
>> which one is the master, so the shutdown order might be B->C->A or A->C->B, 
>> etc.
>>
>> Is it possible to have ansible runs normally over these hosts, read the 
>> exit status of "some_command" and then delay executing shutdown on master 
>> until the others are done?
>>
>>
>> -- 
>> 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 ansible...@googlegroups.com <javascript:>.
>> To post to this group, send email to ansible...@googlegroups.com 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/41bb1f9a-060a-4d1e-a2ae-0a0eabd124d6%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/41bb1f9a-060a-4d1e-a2ae-0a0eabd124d6%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/cf2872bf-3faa-40c1-ac34-7e093dc48040%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to