Last active
December 11, 2015 20:39
-
-
Save darkone23/4657015 to your computer and use it in GitHub Desktop.
Bootstrap a sudoless python 2.4 environment to support ansible via the ansible_python_interpreter var
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# invoke like: ./bootstrap <somehost> -u <someuser> | |
# all invocation time flags will be forwarded to ansible | |
# don't specify module or args | |
# pulls down simplejson to $HOME/.ansible/deps | |
# creates a new ansible_python_interpreter located at $HOME/.ansible/bin/python usable by anyone on the box | |
ansible -m raw $@ -a 'mkdir -p $HOME/.ansible/deps && \ | |
curl http://pypi.python.org/packages/source/s/simplejson/simplejson-2.1.0.tar.gz | \ | |
tar xvz -C $HOME/.ansible/deps && \ | |
mkdir -p $HOME/.ansible/bin && \ | |
echo -e "#!/bin/sh\nexport PYTHONPATH=\\$PYTHONPATH:$HOME/.ansible/deps/simplejson-2.1.0\nexec /usr/bin/python \"\\$@\"" > \ | |
$HOME/.ansible/bin/python && | |
chmod 755 -R $HOME/.ansible/bin/python $HOME/.ansible/deps' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment