# Access to variables in vars/ in custom Ansible module

**URL:** <https://forum.ansible.com/t/access-to-variables-in-vars-in-custom-ansible-module/20576>\
**Category:** Ansible Project\
**Created:** [February 14, 2016, 7:25pm UTC](https://forum.ansible.com/t/access-to-variables-in-vars-in-custom-ansible-module/20576 "2016-02-14T19:25:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gerhardjadzkadzikise](https://avatars.discourse-cdn.com/v4/letter/g/7993a0/32.png) [@gerhardjadzkadzikise](https://forum.ansible.com/u/gerhardjadzkadzikise)\
**Post date:** [February 14, 2016, 7:25pm UTC](https://forum.ansible.com/t/access-to-variables-in-vars-in-custom-ansible-module/20576/1 "2016-02-14T19:25:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [February 14, 2016, 9:53pm UTC](https://forum.ansible.com/t/access-to-variables-in-vars-in-custom-ansible-module/20576/2 "2016-02-14T21:53:58Z")

</div>

Custom modules do not natively have access to vars. You will need to explicitly pass them into the module
