On Tue, Apr 23, 2019, at 8:22 PM, Naren wrote:
> Continuation to previous updated issue...
> 
> What I observed is - ansible is always picking "last" group in the test.ini 
> file
> 

If a single host is in multiple groups, the last definition of a variable wins. 
When you specify a group to target, ansible internally converts it to a list of 
hosts. Once any groups have been resolved to hosts, ansible has no concept of 
which group any host was requested from.

> I have changed the order of groups, below is the complete contents of .ini 
> file
> 
> $ cat test.ini
> [root]
> host1 ansible_user=root
root-host1 ansible_host=host1 ansible_user=root

> 
> [mt]
> host1 ansible_user=applmgr
mt-host1 ansible_host=host1 ansible_user=applmgr

> 
> [db]
> host1 ansible_user=oracle
Etc.

You could use such a workaround. 

V/r,
James Cassell


>  
> 
> all 3 commands show "oracle" user's information rather than their 
> corresponding user's info
> 
> 1) ansible -i test.ini db -m shell -a 'id;pwd;ls;hostname'
> 2) ansible -i test.ini mt -m shell -a 'id;pwd;ls;hostname'
> 3) ansible -i test.ini root -m shell -a 'id;pwd;ls;hostname'
> 
> 
> -- 
> You received this message because you are subscribed to the Google 
> Groups "Ansible Development" group.
> To unsubscribe from this group and stop receiving emails from it, send 
> an email to ansible-devel+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to