@Brian ,  Thanks a lot for your suggestion, this looks Great,

What about "when: inventory_hostname == groups.hosts"  when: 
inventory_hostname == groups.hosts[0] , i google around but did not get 
clear & explicit explanation about its usage

On Monday, March 12, 2018 at 9:02:11 PM UTC+5:30, Brian Coca wrote:
>
> First of all you are comparing a string (inventory_hostname) to a list 
> (groups.hosts, which is [host-test1, host-test2, noi-pranjala]). 
>
> if you want to match inventory-hostname to ansible_hostname, just do that: 
>
>
> when: inventory_hostname == ansible_hostname 
>
>
> that will skip the task when they don't match. 
>
>
> if you want the task to actually fail: 
>
>
> failed_when: inventory_hostname != ansiblie_hostname 
>
>
> ---------- 
> Brian Coca 
>

-- 
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/ca01ad77-4c40-4f5e-8162-32636a1c7a6a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to