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`
On Thu, Sep 27, 2018 at 11:42 PM Saurabh <[email protected]> wrote: > 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. > > > > On Thursday, September 27, 2018 at 4:22:40 PM UTC+5:30, Saurabh wrote: >> >> 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 >> > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/0f9ba345-3545-43f4-a809-aad1f2123f5b%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/0f9ba345-3545-43f4-a809-aad1f2123f5b%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Matt Martz @sivel sivel.net -- 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAD8N0v-3HpH4GXLKNfwBfc%2BLkkx_5GkZDjUUri3d%2B_mbGHm2-w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
