How can i get hosts variable value from ansible yaml file for a particular playbook to custom python module?

15 views
Skip to first unread message

thameem ansari

unread,
Sep 10, 2019, 2:06:34 AM9/10/19
to Ansible Development
How can i get hosts variable value from ansible yaml file for a particular playbook to custom python module?

Tom Davison

unread,
Sep 10, 2019, 6:53:04 PM9/10/19
to thameem ansari, Ansible Development
Would the custom module be apart of the same playbook that the host variable is in? Or separate?

If it apart of the same playbook My first thought is to pass the j2 host variable nto the custom python module as a parameter, if it is an Ansible module that is. Otherwise you should be able to pass it into the module as a sys.argv as well and let the custom module perform its logic from there. 



On Tue, Sep 10, 2019 at 01:06 thameem ansari <kstha...@gmail.com> wrote:
How can i get hosts variable value from ansible yaml file for a particular playbook to custom python module?

--
You received this message because you are subscribed to the Google Groups "Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-deve...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-devel/1900adfe-e90d-4ddf-8755-41981a8a51dc%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages