# Python Annoying error when connecting to target machines

**URL:** <https://forum.ansible.com/t/python-annoying-error-when-connecting-to-target-machines/24382>\
**Category:** Ansible Developer\
**Created:** [May 2, 2017, 5:31pm UTC](https://forum.ansible.com/t/python-annoying-error-when-connecting-to-target-machines/24382 "2017-05-02T17:31:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anthony\_Youssef](https://avatars.discourse-cdn.com/v4/letter/a/958977/32.png) [@Anthony\_Youssef](https://forum.ansible.com/u/Anthony_Youssef)\
**Post date:** [May 2, 2017, 5:31pm UTC](https://forum.ansible.com/t/python-annoying-error-when-connecting-to-target-machines/24382/1 "2017-05-02T17:31:04Z")

</div>

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 \nCould not find platform dependent libraries \<exec\_prefix\>\nConsider setting $PYTHONHOME to [:\<exec\_prefix\>]\n’import site’ failed; use -v for traceback\nTraceback (most recent call last):\n File "", line 4, in \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 "", line 1, in \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 "", line 1, in \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

}  
`

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
