Bootstrapping versions with the pip module

Is this currently possible with Ansibles pip module? I have been googling and trying different ways all morning but come up empty handed.

Say I want to install the latest 1.2 version of a specific package with pip, but not 1.3.x versions due to compatibility issues. Manually I could run:

pip package>=1.2,<1.3

And this would do the trick. But using the version parameter in Ansibles pip module seems to expect a specific version only. I can’t specify the version parameter to be >=1.2,<1.3, this gives an error.
Then I tried bypassing the version parameter by specifying name=“package>=1.2,<1.3” but Ansible caught me and gave me a msg: version must be specified in the version parameter error.

I could obviously set the version to the latest 1.2.x version and update if bug fixes are made. But it would be very neat if it could be done automatically.

Thankful for all suggestions

/Gustav

You could use the pip module with a requirements.txt.

I do agree version should be specified in the version parameter.

I do welcome attempts to upgrade the module, should you wish to try!

Hi Michael
The requirements.txt could be a way to go, might require some restructuring but thanks for the suggestion.
And if I have some time over I might have a go at implementing the function :slight_smile:

Regards Gustav