On Wednesday, 24 December 2014 19:10:55 UTC+5:30, Brian Coca wrote:
>
> I'm very confused as to what you are attempting.
>
I'm basically trying to reuse an exiting playbook, by passing a new host
pattern to it, from another play. One use case is, I have a "common" play
that runs on all hosts. I have another play that spawns new nodes. After
spawning new nodes, I include this common play, and need a way to pass the
new hosts to the common play. This common play cannot be a role, because
there are certain decisions I make based on the pattern, and pass
parameters to the role.
>
> First, 'groups' is not available at the host pattern level, as it is
> host dependent.
>
I was under the impression that groups was at the "current playbook" scope,
as its available for new plays in the same playbook (operating on different
hosts pattern).
> Second, the default filter does work, you can test this easily with:
>
> - hosts: "{{cli_hosts|default('new_instances')}}"
>
> having the ternary condition you want (if no new_instances) is a lot
> harder as the group won't get evaluated until after the expression is.
>
>
The reason I have the ternary condition is I'm unable to pass the new host
pattern to "cli_hosts", if I could do that, than the pattern expression
will be simpler. Is there a way I can do that? that is pass the host
pattern via include.
--
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/9aabea64-22f1-4bb9-8ff1-60fc4aa8e7bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.