Reputation: 3113
My new ec2 host has default python2.6.
I have script python_27.sh
which basically update the PATH with python 27 and export some other stuff like LD_LIBRARY_PATH
to enable python 2.7
Then i create virtualenv with that python like /home/ansible/virualenv
This i am using in hosts like
ansible_python_interpreter=/home/ansible/virualenv
The error i get is
libpython2.7.so.1.0: cannot open shared object file: No such file or
directory
I think that is because when ansible ssh into it it does not source python 2.7 sh file which enables the new library config.
Is there any way ansbile can source that first thing before ssh
Upvotes: 0
Views: 952
Reputation: 64563
Instead of ~/.bashrc
sourcing, you can do the following:
ansible_python_interpreter=env LD_LIBRARY_PATH=/your/path/here /home/ansible/virualenv
So you will not source ~/.bashrc
(what generaly speaking is not a good idea),
but set only the variable you need.
Upvotes: 1