I'm confused by this as well.

When you say you are not using an inventory file, do you mean you are using
the dynamic inventory plugin?

If you want a group that contains just the new hosts you have brought
online, or want to add new hosts (in memory) to an existing host name, look
at how the "add_host" plugin is used in various examples -- it does exactly
this.



On Mon, May 12, 2014 at 10:38 AM, Paul Durivage <[email protected]>wrote:

> I don't think what you want to do is override a value at runtime, but
> rather *create* a new group dynamically at runtime.  Make a new group for
> hosts that meet some arbitrary criteria.  See the 
> group_by<http://docs.ansible.com/group_by_module.html>module -- I think 
> you'll find what you're looking for there.
>
>
> On Sat, May 10, 2014 at 9:10 PM, JC <[email protected]> wrote:
>
>> Hi guys,
>>
>> Anyone know if you can completely override the hosts: value in a playbook?
>>
>> I don't use inventory files so I always just have this set to 'all'.  But
>> when I call a playbook from another playbook like this, for example:
>>
>> # Playbook1
>> - name: Format EBS volumes
>>   hosts: ec2_group # coming from the ec2 module and add_host
>> ...
>>
>> - include: playbook2.yml hosts=ec2_group
>>
>> or
>>
>> - { include: playbook2.yml, hosts: ec2_group }
>>
>> It works but then it also tries to run the playbook to the 'all' group
>> (which is everything in my default hosts file).  I want the 'all' value to
>> be completely overridden by the new value I specified.
>>
>> Is there a better way to do this without creating an inventory file?
>>
>> Thanks
>>
>> --
>> 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/9b3f20c0-ac19-4ea1-97da-2fc848588b39%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/9b3f20c0-ac19-4ea1-97da-2fc848588b39%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> 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/CAK6JQEF3sJnL6LnJ2eaMMHP6J6rS3VsdobyjJiC%3DMNne0v1U9g%40mail.gmail.com<https://groups.google.com/d/msgid/ansible-project/CAK6JQEF3sJnL6LnJ2eaMMHP6J6rS3VsdobyjJiC%3DMNne0v1U9g%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CA%2BnsWgwviuTdsEMyebpLO2N1jYV3yF8eA1r2ej%2BFOTiBmSMXfQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to