I'm trying to figure out how to make includable playbooks that
1) Work like normal playbooks when run via ansible, running an a group of
hosts
2) Only run on the group of hosts from (1) that intersects with the hosts
of the includer.
(Use case: I have a playbook for initializing our Jenkins slaves. Sometimes
I need to run it directly to update all of the slaves to a new
configuration. But sometimes I'm setting up a type of server that includes
being a slave and I just need to include the role so that all servers of
that type are setup correctly.)
This seems like a common use case, but I can't find it in the documentation
which makes me wonder if I have the wrong approach. Here's what I have so
far:
*JenkinsSlave.yml*
- name: JenkinsSlave creation
hosts: jenkinslaves:&{{hosts}}
...
*BuildServer.yml*
- include: JenkinsSlave.yml hosts=BuildServers
...
The above works for inclusion, but doesn't work when I run
JenkinsSlaves.yml because hosts is empty and so the intersection of
JenkinsSlave and hosts is none. I'd like something like
:&{{hosts|default(all)}} but that doesn't seem to work the way I expect.
Thanks for all feedback,
Alan
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/d277439c-84ec-4cd7-9aca-1b8e91602a3f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.