Best way to pass the password to dynamic inventory script

34 views
Skip to first unread message

Kumar

unread,
Apr 12, 2019, 11:27:40 AM4/12/19
to Ansible Project
Hello ,

I have created a dynamic inventory script and it requires credentials for login and pull the host names.
So what is the best way to pass credentials to dynamic inventory script.
I have seen some docs on ansible doco where passing credentials from .ini file as plain text.
Also i have seen exporting as environment variables.
Can i use something like encryption module in python or are there any best practices.

Thanks,
Kumar.

Brian Coca

unread,
Apr 18, 2019, 12:15:04 PM4/18/19
to Ansible Project
I would recommend using an inventory plugin instead, then you can use
a vaulted inventory source with the credentials.

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

Rakesh Kumar

unread,
Apr 18, 2019, 9:58:59 PM4/18/19
to ansible...@googlegroups.com
I have already developed a scirpt. And plugin wont work in our current solution. I do not have plugins from ansible to use.
So i developed a scirpt. Still need a solution to pass credentials to dynamicinventoryscirpt.py


--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/LKJRD-5-Dak/unsubscribe.
To unsubscribe from this group and all its topics, 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/CACVha7fDw1vt82dorDX%3DY4BOwkh3%2B3%2BVMNzve6czwPR7%2B-3pfg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Brian Coca

unread,
Apr 22, 2019, 10:38:30 PM4/22/19
to Ansible Project
Well, scripts are used via the 'script' plugin, so you are already
using plugins. Scripts are very easy to create, they just need to
output properly formatted JSON, but the problem with scripts, is that
the are externally executed and cannot use facilities (like vault)
that Ansible provides. Inventory plugins are a little harder to
create, but have access to many more features from inside Ansible.

-
----------
Brian Coca
Reply all
Reply to author
Forward
0 new messages