Ansible Python Module Error.

Hi All,

if i give os.path.dirname(os.path.abspath(os.path.realpath(ansible.file))) command in python terminal will give me “/usr/lib/python2.7/site-packages/ansible”

but if same command i write in own ansible python module. it give this path :- /tmp/ansible_29S4ql/ansible_modlib.zip/ansible

Could you please help me for this issue ?

Regads
Saurabh

What is the issue then?

Issue is that, I want to get /usr/lib/python2.7/site-packages/ansible path. if i mention in ansible python module code this line os.path.dirname(os.path.abspath(os.path.realpath(ansible.file))).

It’s not giving me actual path but it’s giving me /tmp/* path example ( /tmp/ansible_29S4ql/ansible_modlib.zip/ansible )

how can i achieve so that i can get /usr/lib/python2.7/site-packages/ansible path dynamically depend on python 2.7 or python 3* version.

Could you please help me for this.

Ansible modules should not attempt to import code from Ansible itself.

An ansible module has access to a custom built (stripped down) ansible package for importing things from ansible.module_utils