[ansible-openwisp2] Upgrade pip deps from requirements on rerun
Checklist
- [x] I have read the OpenWISP Contributing Guidelines.
- [x] I have manually tested the changes proposed in this pull request.
- [ ] I have written new test cases for new code and/or updated existing tests for changes to existing code.
- [ ] I have updated the documentation.
Reference to Existing Issue
Closes #572
Description of Changes
update the pip.yml file with extra-args:"--upgrade" which make sure that every dependency is updated.
@pandafy PTAL
Good start @Piyushrathoree!
I am afraid that
--upgrademight not always work when we use tarball URL as source. E.g. when we set openwisp-controller version in the ansible playbookopenwisp2_controller_version: openwisp-controller @ https://github.com/openwisp/openwisp-controller/tarball/masterIn such scenarios, we would need to use
state: forcereinstall.Using
forcereinstallby default will slow down the playbook, since it will make pip reinstall packages even when the latest package have been installed.I can think of exposing
pip.extra_argsargument through ansible variableopenwisp2_pip_extra_args. The default value for this argument will beopenwisp2_pip_extra_args: "--upgrade". When needed, the user can override the variable in the playbook to use `openwisp2_pip_extra_args: "--upgrade --force-reinstall" which will force-reinstall the packages.We will need to add this new variable in https://github.com/openwisp/ansible-openwisp2/blob/master/docs/user/role-variables.rst, and explain the usage with a comment. You can take reference from other settings mentioned in the file.
thanks @pandafy made some changes according to what you've said , please take a look .