Hello,

On Thu, 28 Nov 2013 15:31:17 -0500
Michael DeHaan <mich...@ansibleworks.com> wrote:

> "Having there one play with "- hosts: service1" and another with "-
> hosts: service2", one might expect that
> 
> "ansible-playbook -i hosts_devel -l "service1:&vagrant" site.yml"
> would run only play with "- hosts: service1". However, both are run:"
> 
> Nope, both plays are run, however the hosts are limited down to
> things in the service1 and vagrant groups.
> 
> Your localhost box is selected in the service2 play because devel has
> vagrant has localhost.
> 
> Working as designed.

... or in other words, Ansible doesn't do "hierarchical", symbolic
matching, just reduces all symbolic expressions to host sets and
does set arithmetic on them - well, that was said in the original mail,
and I don't argue it should do it differently.

The original question still remains - how to "tell" Ansible that
"localhost:&service1" and "localhost:&service2" are two "different"
localhosts and it should discriminate tasks on "service1 vs
service2" part, not unify all tasks together based on "localhost" part?

My thinking led me to an idea that host inventory files for ambiguous
hosts (devel hosts in this case) need to be split per "service" axis
(just like I already did by development/production axis). That will get
rid of ambiguity - for each localhost, there will be a single service in
Ansible's scope. Bad news is that it's not DRY - for 100 services,
there will be need for 100 inventory files ;-(. "Good" news is that
they are all similar, so can be generated/maintained by a meta-level
script. I still wonder if there's a better solution.



-- 
Best regards,
 Paul                          mailto:pmis...@gmail.com

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to