I would like to add support for specifying the Python version when running the pip and easy_install modules since I have systems with both Python 2.7 and 3.3 installed.
This should be a fairly trivial patch. I am struggling a bit with how specify the module arguments for this feature. Should it have:
- A python_version argument that then gets appended to the pip and easy_install executables? E.g python_version=3.3 would result in the pip-3.3 being invoked.
- A executable argument where the pip / easy_install executable default (pip / easy_install) is explicitly overriden? E.g executable=pip-3.3.
What would be the option most consistent with similar functionality in existing modules?
Thanks in advance for advice regarding this.
–Pedro.
I am leaning towards specifying the command explicitly with command argument to be consistent with virtualenv_command. Any suggestions where it should go in the arguments order? After all other currently existing arguments?
–Pedro.
This is already possible with the ansible_python_interpreter option in inventory. Please see http://www.ansibleworks.com/docs/patterns.html for more details on how to use it.
Hi James,
Sorry but your answer confused me a bit. I am not talking about the interpreter that is running the ansible tasks. This question is specifically for the ‘easy_install’ and ‘pip’ modules which, by default, simply execute the remote ‘easy_install’ and ‘pip’ system commands or optionally the same commands installed in a virtualenv. So it is not clear to me how the ‘ansible_python_interpreter’ inventory option would have any effect on the execution of those modules.
–Pedro.
Seems like you would want to pass executable=
Much cleaner and more flexible than trying to find the binary.
Oh I see, I thought you were talking about the ansible modules by the same names, not the command line executables. Changing the python interpreter for those may be somewhat out of the scope of ansible, short of setting the PYTHON* environment using ansible’s environment options.