I want to pip install
with --upgrade
, using Ansible.
What's the syntax?
- name: install the package, force upgrade
pip:
name: <your package name>
state: latest
Or with:
- name: install the package, force reinstall to the latest version
pip:
name: <your package name>
state: forcereinstall
Eventually found the answer here: https://groups.google.com/forum/#!topic/ansible-project/a19JEpdXzck
this is the syntax:
- name: install the package, force upgrade
pip:
name: <your package name>
extra_args: --upgrade
shell: > pip install --upgrade pip
and this is better due I am avoid the ansible-lint rule for shell commands.
If you need upgrade pip for other python version, you can use executable parameter:
- name: install the package, force upgrade
pip:
name: pip
executable: pip3
state: latest