Skip to content
3 changes: 3 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -236,3 +236,6 @@ openwisp2_radius_periodic_tasks: true
openwisp2_usage_metric_collection_periodic_tasks: true
# point {{ inventory_name }} to localhost in /etc/hosts
openwisp2_inventory_hostname_localhost: true
# openwisp2_pip_extra_args controls extra pip arguments used when installing or
# reinstalling OpenWISP Python packages and dependencies.
openwisp2_pip_extra_args: "--upgrade"
5 changes: 5 additions & 0 deletions docs/user/role-variables.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ take a look at `the default values of these variables
openwisp2_monitoring_version: "openwisp-monitoring~=1.0.0"
openwisp2_radius_version: "openwisp-radius~=1.0.0"
openwisp2_django_version: "django~=3.2.13"
# Extra arguments passed to pip when reinstalling Python packages with --force-reinstall
# By default, packages are upgraded on each playbook run.
# Can be overridden, for example:
# openwisp2_pip_extra_args: "--upgrade --force-reinstall"
Comment on lines +34 to +37

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Extra arguments passed to pip when reinstalling Python packages with --force-reinstall
# By default, packages are upgraded on each playbook run.
# Can be overridden, for example:
# openwisp2_pip_extra_args: "--upgrade --force-reinstall"
# Extra arguments passed to pip when installing Python packages.
# By default, packages are upgraded on each playbook run.
# Can be overridden, for example:
# openwisp2_pip_extra_args: "--upgrade --force-reinstall"

openwisp2_pip_extra_args: "--upgrade"
# Setting this to true will enable subnet division feature of
# openwisp-controller. Refer openwisp-controller documentation
# for more information. https://github.com/openwisp/openwisp-controller#subnet-division-app
Expand Down
10 changes: 10 additions & 0 deletions tasks/pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
state: latest
virtualenv: "{{ virtualenv_path }}"
virtualenv_python: "{{ openwisp2_python }}"
extra_args: "{{ openwisp2_pip_extra_args }}"
environment:
LC_CTYPE: "en_US.UTF-8"
notify: Reload application
Expand All @@ -43,6 +44,7 @@
requirements: "{{ openwisp2_path }}/requirements.txt"
virtualenv: "{{ virtualenv_path }}"
virtualenv_python: "{{ openwisp2_python }}"
extra_args: "{{ openwisp2_pip_extra_args }}"
notify: Reload application
retries: 5
delay: 10
Expand All @@ -58,6 +60,7 @@
state: latest
virtualenv: "{{ virtualenv_path }}"
virtualenv_python: "{{ openwisp2_python }}"
extra_args: "{{ openwisp2_pip_extra_args }}"
notify: Reload application
retries: 5
delay: 10
Expand All @@ -73,6 +76,7 @@
state: latest
virtualenv: "{{ virtualenv_path }}"
virtualenv_python: "{{ openwisp2_python }}"
extra_args: "{{ openwisp2_pip_extra_args }}"
notify: Reload application
retries: 5
delay: 10
Expand All @@ -88,6 +92,7 @@
state: latest
virtualenv: "{{ virtualenv_path }}"
virtualenv_python: "{{ openwisp2_python }}"
extra_args: "{{ openwisp2_pip_extra_args }}"
notify: Reload application
retries: 5
delay: 10
Expand All @@ -103,6 +108,7 @@
state: latest
virtualenv: "{{ virtualenv_path }}"
virtualenv_python: "{{ openwisp2_python }}"
extra_args: "{{ openwisp2_pip_extra_args }}"
notify: Reload application
retries: 5
delay: 10
Expand All @@ -123,6 +129,7 @@
requirements: "{{ openwisp2_path }}/requirements-cors-headers.txt"
virtualenv: "{{ virtualenv_path }}"
virtualenv_python: "{{ openwisp2_python }}"
extra_args: "{{ openwisp2_pip_extra_args }}"
when: openwisp2_django_cors.get('enabled')
retries: 5
delay: 10
Expand Down Expand Up @@ -155,6 +162,7 @@
requirements: "{{ openwisp2_path }}/requirements-postgresql.txt"
virtualenv: "{{ virtualenv_path }}"
virtualenv_python: "{{ openwisp2_python }}"
extra_args: "{{ openwisp2_pip_extra_args }}"
when: openwisp2_database.engine in ["django.db.backends.postgresql", "django.contrib.gis.db.backends.postgis"]
retries: 5
delay: 10
Expand All @@ -174,6 +182,7 @@
requirements: "{{ openwisp2_path }}/requirements-mysql.txt"
virtualenv: "{{ virtualenv_path }}"
virtualenv_python: "{{ openwisp2_python }}"
extra_args: "{{ openwisp2_pip_extra_args }}"
when: openwisp2_database.engine in ["django.db.backends.mysql", "django.contrib.gis.db.backends.mysql"]
retries: 5
delay: 10
Expand Down Expand Up @@ -214,6 +223,7 @@
requirements: "{{ openwisp2_path }}/requirements-celery-email.txt"
virtualenv: "{{ virtualenv_path }}"
virtualenv_python: "{{ openwisp2_python }}"
extra_args: "{{ openwisp2_pip_extra_args }}"
when: openwisp2_email_backend == "djcelery_email.backends.CeleryEmailBackend"
notify: Reload application
retries: 5
Expand Down
Loading