Python Annoying error when connecting to target machines

189 views
Skip to first unread message

Anthony Youssef

unread,
May 2, 2017, 2:33:35 PM5/2/17
to Ansible Project

Hi,


i am facing an error that is blocking my work on ansible. i am trying to connect from my control machine to a big number of hosts to execute remote commands (around 1000 hosts).

some of these target hosts didn't have python2.6 installed under /usr/bin/python, thus i was not able to connect to them. 

Unix team suggested to put python2.6 under a shared location and thus all machines will be able to connect to it(shared location=./nettools/python_ansible/bin/python), i updated my "group_vars/all" to point to this location, as per below

 ansible_python_interpreter: /nettools/python_ansible/bin/python

now when trying to connect to remote hosts, i faced many issues related to libraries

    hp214srv | FAILED! => {
     
    "changed": false,
     
    "failed": true,
     
    "module_stderr": "ld.so.1: python: fatal: libpython2.6.so.1.0: open failed: No such file or directory\n/bin/bash: line 1: 3469 Killed /nettools/python_ansible/bin/python\n",
     
    "module_stdout": "",
     
    "msg": "MODULE FAILURE"
    }

only machines having python2.6 installed locally were still able to connect since libpython2.6.so.1.0 was found locally (i knew this after running ldd on the python executable)

what i did next, is that i created a wrapper /nettools/python_ansible/bin/python.sh and below is the code inside the wrapper

    hp225srv autoengine /usr/local/quality/test/bin/
    bash$ vi python
    .sh
    "python.sh" 6 lines, 1088 characters
    #!/bin/bash
    export PATH="/nettools/subversion/bin:/nettools/python/bin:/nettools/cmake/cmake-2.6.1/bin:/nettools/sudo/sudo1.7.2p1/bin:/usr/local/java/jdk1.7.0_79/bin:.:/usr/local/bin:/usr/bin:/bin:/nfshome/nonuser/autoengine/bin:/usr/sfw/bin:/usr
    /local/tex/bin/:/etc:/usr/etc:/usr/openwin/bin:/usr/ccs/bin:/opt/csw/bin:/opt/HPQhealth/sbin/:/opt/HPQacucli/sbin/:/sbin:/usr/sbin:/usr/local/tools:/nettools/tools:/nettools/sunstudio/sunstudio11/SUNWspro/bin:/opt/oracle/11204/bin:/op
    t/sybase/oc12.5.1-EBF12837/OCS-12_5/bin:/nettools/bin:/nfs_tools/common/scripts:/nfs_tools/common/operate:/nfs_tools/common/globalqa:/usr/ucb:/opt/sfw/bin:/usr/sbin:/nettools/python_ansible/bin"

    export LD_LIBRARY_PATH="/usr/local/lib:/usr/local/ssl/lib:/opt/sfw/lib:/usr/lib:/nettools/sunstudio/sunstudio11/SUNWspro/lib:/opt/oracle/11204/lib:/nettools/sudo/sudo1.7.2p1/lib:/nettools/cmake/cmake-2.6.1/share/cmake-2.6/Lib:/nettool
    s/python/lib:/nettools/lib:/usr/ucblib:/nettools/subversion/lib:/nettools/python_ansible/lib"

    export PYTHONHOME="/nettools/python_ansible"
    echo
    "ayoussef"
    exec /nettools/python/bin/python "$@"


this time where running ansible -m ping dell190srv,dell201srv,dell027srv,hp214srv,hp244srv  from control machine i got the below output


    hp244srv | FAILED! => {
     
    "changed": false,
     
    "failed": true,
     
    "module_stderr": "Could not find platform independent libraries <prefix>\nCould not find platform dependent libraries <exec_prefix>\nConsider setting $PYTHONHOME to <prefix>[:<exec_prefix>]\n'import site' failed; use -v for traceback\nTraceback (most recent call last):\n File \"<stdin>\", line 4, in <module>\nImportError: No module named os\n",
     
    "module_stdout": "",
     
    "msg": "MODULE FAILURE"
    }
    hp214srv
    | FAILED! => {
     
    "changed": false,
     
    "failed": true,
     
    "module_stderr": "ld.so.1: python: fatal: relocation error: file /nettools/python_ansible/lib/libpython2.6.so.1.0: symbol fdatasync: referenced symbol not found\n/bin/bash: line 1: 5699 Killed /nettools/python_ansible/bin/python.sh\n",
     
    "module_stdout": "",
     
    "msg": "MODULE FAILURE"
    }
    An exception occurred during task execution. To see the full traceback, use -vvv. The error was: NameError: name 'false' is not defined
    dell201srv
    | FAILED! => {
     
    "changed": false,
     
    "failed": true,
     
    "module_stderr": "Traceback (most recent call last):\n File \"<stdin>\", line 1, in <module>\nNameError: name 'false' is not defined\n",
     
    "module_stdout": "",
     
    "msg": "MODULE FAILURE"
    }
    An exception occurred during task execution. To see the full traceback, use -vvv. The error was: NameError: name 'false' is not defined
    dell190srv
    | FAILED! => {
     
    "changed": false,
     
    "failed": true,
     
    "module_stderr": "Traceback (most recent call last):\n File \"<stdin>\", line 1, in <module>\nNameError: name 'false' is not defined\n",
     
    "module_stdout": "",
     
    "msg": "MODULE FAILURE"
    }
    dell027srv
    | UNREACHABLE! => {
     
    "changed": false,
     
    "msg": "SSH Error: data could not be sent to the remote host. Make sure this host can be reached over ssh",
     
    "unreachable": true
    }

  1. this is really annoying as it is blocking my progress in learning this tool, i am in the middle of the course and i like it.

    Please can anyone help me and tell me what is missing, why i am not able to connect to these machines, and what is the best way to do so?

    i have been searching for one week for a solution and still no success.

    waiting for your help, Thanks in advance!

    Regards,

    Anthony


Dick Davies

unread,
May 2, 2017, 3:09:40 PM5/2/17
to ansible list
It looks like your install of Python isn't complete, or you're missing
some required env.
vars.

Back to your UNIX team?
> --
> 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/0365e464-4493-41d9-858f-dd82d814d1f7%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Anthony Youssef

unread,
May 3, 2017, 2:02:51 AM5/3/17
to Ansible Project, di...@hellooperator.net
Hi,

yeah, but is it possible to execute ansible on remote hosts using python located on a shared location , python should be installed on these remote hosts?
I am asking thia to prevent install python on this big number of machines..
Reply all
Reply to author
Forward
0 new messages