we have python 3 installed and working correctly when the $PATH and $LIBPATH are set. However, as I want to use python for running Ansible against the LPAR .bashrc and .profile can’t be used.
Ansible uses SSH remote commands to work, the equiv of:-
ssh winmvs2c.hursley.ibm.com ‘python --version’
How can I update USS so that python 3 is available for all users without relying on .bashrc or .profile and will work with non-interactive SSH sessions?
IBM Senior Software Engineer - CICS TS
You can set PATH as part of the ssh command.
ssh pdharr@rs25 PATH=/u/pdharr/miniconda/bin:/bin XYZ=a python -c “’”‘import os; print(os.getenv(“XYZ”))’"’"
Hi Rick, that has worked thank you. Makes the anisble host inventory a bit messy:-
ansible_python_interpreter: ‘PATH=/python/v361/python-2017-04-12-py36/python36/bin:/usr/bin:/bin:/usr/sbin LIBPATH=/python/v361/python-2017-04-12-py36/python36/lib:/lib:/usr/lib python’
Would be nice if somehow in USS we can set this, but I can’t find it.
I’m not that good at Ansible so a couple of questions first:
What’s your default shell - is it /bin/sh or bash?
Is there a reason why you can’t use .bashrc (provided your default shell is bash) ? My understanding is that it gets executed on non-interactive logons as well.
If you already have PATH/LIBPATH in .profile or some other script, can’t you just run that script before invoking python? Something like this:
ssh user@host '. ~/.profile; python --version'