Choosing and adhoc host without inventory file

694 views
Skip to first unread message

Roger Qiu

unread,
May 19, 2014, 10:28:34 PM5/19/14
to ansible...@googlegroups.com
Sometimes I just want to contact a random host (this host's IP is ephemeral/discovered during the operation), and execute an adhoc module.

Is there a way to do this?

It seems Ansible always requires an inventory file, but editing the inventory file just to do an adhoc command on a host address that won't exist afterwards is a bit unnecessary.

James Cammarata

unread,
May 20, 2014, 12:59:43 AM5/20/14
to ansible...@googlegroups.com
For simple testing, you can use the "-i <host>," syntax (don't forget the comma at the end, it is required). This should only be used for testing purposes, we always recommend you use some sort of inventory file or dynamic inventory script for regular use.


--
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/1e7b0a62-ae25-4a6e-8381-4d14fcc9c70f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Scott Anderson

unread,
May 20, 2014, 12:54:58 PM5/20/14
to ansible...@googlegroups.com
I use a "local" inventory file with a single line for this:

127.0.0.1


Regards,
-scott
Reply all
Reply to author
Forward
0 new messages