Access to variables in vars/ in custom Ansible module

32 views
Skip to first unread message

Gerhard

unread,
Feb 14, 2016, 2:25:25 PM2/14/16
to Ansible Project
Hello,

I am developing custom ansible module to do something and i will implement this module as one of task in my new role.
The new custom module is written in python 2.7.

I know how to get variables passing to module in playbook, like:

- name: task 1
  custom_module_name: arg1='foo'

And in python code:   module.param.get()

And question is, how to get variables stored in vars/main.yml file or   group_vars/all  file in this (python)  custom module?

Regards,
Gerhard

Matt Martz

unread,
Feb 14, 2016, 4:54:49 PM2/14/16
to ansible...@googlegroups.com
Custom modules do not natively have access to vars.  You will need to explicitly pass them into the module

--
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/7b8f640c-e83e-4ad4-9374-9c662ab73b5b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Matt Martz
@sivel
sivel.net
Reply all
Reply to author
Forward
0 new messages