The trailing comma is only needed if there is only one host, FWIW.   It's a
hack and undocumented for a reason -- it might be supplanted by a different
option later, maybe.

That being said, you are very well served for setting up an inventory file,
as groups are a useful concept, and if you have to set variables, it's much
easier than remembering them.   Group_vars and host_vars don't work in the
ways you specified above, and various plays that depend on iterating across
groups won't have that information.

I'd still strongly encourage everyone to set up inventory.


On Sat, Feb 22, 2014 at 8:30 AM, Serge van Ginderachter <
[email protected]> wrote:

>
> On 22 February 2014 14:25, Aaron Hunter <[email protected]> wrote:
>
>> I often want to create and share stand-alone, single plays (i.e.,
>> some_task.yml). Ansible makes it very easy to automate tedious admin tasks
>> so I like to use it instead of old-school shell scripting. This works fine
>> of course but there is one small friction point in the form of the
>> inventory file. It would be cool if I could run a stand-alone play without
>> an inventory file (the host is already in the play) just be typing
>> 'ansible-playbook some_task.yml'
>
>
> That will never be possible with just as task file, bit given you have a
> minimal playbook containing
>
> - hosts: all
>   tasks:
>   - name: some task
>     action: ...
>
> there is a trick to do just that;
>
>    ansible-playbook all -i my.one.off.host.name, play.yml
>
> Note the trailing comma at the end of the inventory.
>
>
> Serge
>
>  --
> 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/CAEhzMJC-zrTggMgD%3D0B5_J4r6LFcnptZ6jeqfA2Cz8Tr23E43Q%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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/CAEVJ8QORxa6k2%2B72sFX5p0QB0btYyNNFDoVwtZ9rzzjJYRbEZQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to