Dynamic Inventory script

54 views
Skip to first unread message

Tuyen Nguyen

unread,
Nov 24, 2018, 2:26:13 PM11/24/18
to Ansible Project
Hi

Is there any simple dynamic inventory script that would read from a local file contain list of hostnames only?

Samer Odeh

unread,
Nov 24, 2018, 2:41:18 PM11/24/18
to ansible...@googlegroups.com
did you try to simply cat the file ?

On Sat, Nov 24, 2018 at 8:26 PM Tuyen Nguyen <daica...@gmail.com> wrote:
Hi

Is there any simple dynamic inventory script that would read from a local file contain list of hostnames only?

--
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/b7213d5d-cdd3-4b02-bcf9-9e1145a9f4cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tuyen Nguyen

unread,
Nov 27, 2018, 2:17:47 PM11/27/18
to Ansible Project
Hi

No, but I thought that the format of the script needs to adhere to a JSON format.

Brian Coca

unread,
Nov 27, 2018, 10:37:18 PM11/27/18
to ansible...@googlegroups.com
a 'flat file' will work with the ini plugin, no need to create a script.



--
----------
Brian Coca

Tuyen Nguyen

unread,
Dec 5, 2018, 10:25:51 AM12/5/18
to Ansible Project
Hi

Oh, can you explain how you would do that in the Ansible code?  I have just started using Ansible and I don't know the language too well.  Thanks.

Kai Stian Olstad

unread,
Dec 6, 2018, 3:43:55 AM12/6/18
to ansible...@googlegroups.com
On 05.12.2018 16:25, Tuyen Nguyen wrote:
> Oh, can you explain how you would do that in the Ansible code? I have
> just
> started using Ansible and I don't know the language too well. Thanks.

There is no code, default Ansible inventory is just a file with one host
on each line.
https://docs.ansible.com/ansible/2.7/user_guide/intro_inventory.html#hosts-and-groups

--
Kai Stian Olstad
Reply all
Reply to author
Forward
0 new messages