Ansible Python Module Error.

26 views
Skip to first unread message

Saurabh

unread,
Sep 27, 2018, 6:52:40 AM9/27/18
to Ansible Project
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 

Ankit Vashistha

unread,
Sep 27, 2018, 12:10:55 PM9/27/18
to ansible...@googlegroups.com
What is the issue then?

--
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/48c9f375-0933-4b98-bd31-6de150390396%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Saurabh

unread,
Sep 28, 2018, 12:42:44 AM9/28/18
to Ansible Project
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. 

Matt Martz

unread,
Sep 28, 2018, 10:11:33 AM9/28/18
to ansible...@googlegroups.com
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`



--
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.

For more options, visit https://groups.google.com/d/optout.


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