I'm trying to dynamically build the group of hosts that will be used in a play. I'm doing this within a hosts: localhost play. However hostvars seems to be undefined when evaluating the - hosts: line. Suggestions?
--
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-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/cf79d4c8-480f-4120-8229-464666702a92%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Thanks Steve. This sounds very much like what I'm trying to do. In my case I want to enforce some rules, defaults and aliases on a host group selected via --extra-vars. Thought I would do that with a localhost Play and set_facts, as you described. If this is the wrong approach I'm happy to get steered in the right direction. I started looking at dynamic inventory but this seems to be overkill for my current need. It also feels like the wrong direction. Another option I'm considering is a jinja2 function. Eg. - hosts: "{{ myj2func() }}
--
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-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/88a2323f-8fcc-4dec-b372-80a9ad31114a%40googlegroups.com.