Skip to content

Commit

Permalink
[pip] Add a way to specify a different source for each openwisp2 module
Browse files Browse the repository at this point in the history
#25

Implements and closes #25
  • Loading branch information
R9295 authored and nemesifier committed Nov 29, 2017
1 parent bcb4395 commit 3151bd0
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 99 deletions.
17 changes: 8 additions & 9 deletions README.md
Expand Up @@ -298,15 +298,14 @@ Below are listed all the variables you can customize (you may also want to take
vars:
# optional openwisp2 modules
openwisp2_network_topology: false
# you may set one of these variables to true if you need to
# use the development version of a specific openwisp2 module
openwisp2_controller_dev: false
openwisp2_users_dev: false
openwisp2_django_netjsonconfig_dev: false
openwisp2_django_x509_dev: false
openwisp2_netjsonconfig_dev: false
openwisp2_network_topology_dev: false
openwisp2_django_netjsongraph_dev: false
#you may replace the values of these variables with a PIP supported URL to install a custom #version of an openwisp2 module.
openwisp2_controller_pip: openwisp-controller
openwisp2_users_pip: openwisp-users
openwisp2_django_netjsonconfig_pip: django-netjsonconfig
openwisp2_django_x509_pip: django-x509
openwisp2_netjsonconfig_pip: netjsonconfig
openwisp2_network_topology_pip: openwisp-network-topology
openwisp2_django_netjsongraph_pip: django-netjsongraph
# by default python3 is used, if may need to set this to python2.7 for older systems
openwisp2_python: python2.7
# customize the app_path
Expand Down
18 changes: 11 additions & 7 deletions defaults/main.yml
@@ -1,12 +1,16 @@
openwisp2_python: python3

openwisp2_network_topology: false
openwisp2_controller_dev: false
openwisp2_users_dev: false
openwisp2_django_netjsonconfig_dev: false
openwisp2_django_x509_dev: false
openwisp2_netjsonconfig_dev: false
openwisp2_network_topology_dev: false
openwisp2_django_netjsongraph_dev: false

openwisp2_controller_pip: "openwisp-controller"
openwisp2_users_pip: "openwisp-users"
openwisp2_django_netjsonconfig_pip : "django-netjsonconfig"
openwisp2_django_x509_pip: "django-x509"
openwisp2_netjsonconfig_pip: "netjsonconfig"
openwisp2_network_topology_pip: "openwisp-network-topology"
openwisp2_django_netjsongraph_pip: "django-netjsongraph"


openwisp2_extra_python_packages: [bpython]
openwisp2_extra_django_apps: []
openwisp2_path: "/opt/openwisp2"
Expand Down
95 changes: 12 additions & 83 deletions tasks/pip.yml
@@ -1,3 +1,13 @@
- set_fact:
openwisp2_python_packages: ["{{ openwisp2_controller_pip }}" , "{{ openwisp2_users_pip }}" , "{{ openwisp2_django_netjsonconfig_pip }}", "{{ openwisp2_django_x509_pip }}", "{{ openwisp2_netjsonconfig_pip }}","{{ openwisp2_django_netjsongraph_pip }}"]

- name: Add network_topology to package list if enabled
when: openwisp2_network_topology
set_fact:
openwisp2_python_packages: "{{ openwisp2_python_packages }} + [ '{{ openwisp2_network_topology_pip }}' ]"



- name: Update pip & related tools
pip:
name: "{{ item }}"
Expand All @@ -10,98 +20,17 @@
- setuptools
- wheel

- name: Install openwisp2 controller and its dependencies
- name: Install OpenWISP2 Python packages
pip:
name: "{{ item }}"
state: latest
virtualenv: "{{ virtualenv_path }}"
virtualenv_python: "{{ openwisp2_python }}"
virtualenv_site_packages: yes
with_items:
- openwisp-controller
notify: reload supervisor

- name: Install openwisp2 network topology and dependencies
when: openwisp2_network_topology
pip:
name: "{{ item }}"
state: latest
virtualenv: "{{ virtualenv_path }}"
virtualenv_python: "{{ openwisp2_python }}"
virtualenv_site_packages: yes
with_items:
- openwisp-network-topology
notify: reload supervisor

- name: Install development version of openwisp-controller
when: openwisp2_controller_dev
pip:
name: https://github.com/openwisp/openwisp-controller/tarball/master
state: latest
virtualenv: "{{ virtualenv_path }}"
virtualenv_python: "{{ openwisp2_python }}"
virtualenv_site_packages: yes
notify: reload supervisor

- name: Install development version of openwisp-users
when: openwisp2_users_dev
pip:
name: https://github.com/openwisp/openwisp-users/tarball/master
state: latest
virtualenv: "{{ virtualenv_path }}"
virtualenv_python: "{{ openwisp2_python }}"
virtualenv_site_packages: yes
notify: reload supervisor
- "{{ openwisp2_python_packages }}"

- name: Install development version of django-netjsonconfig
when: openwisp2_django_netjsonconfig_dev
pip:
name: https://github.com/openwisp/django-netjsonconfig/tarball/master
state: latest
virtualenv: "{{ virtualenv_path }}"
virtualenv_python: "{{ openwisp2_python }}"
virtualenv_site_packages: yes
notify: reload supervisor

- name: Install development version of netjsonconfig
when: openwisp2_netjsonconfig_dev
pip:
name: https://github.com/openwisp/netjsonconfig/tarball/master
state: latest
virtualenv: "{{ virtualenv_path }}"
virtualenv_python: "{{ openwisp2_python }}"
virtualenv_site_packages: yes
notify: reload supervisor

- name: Install development version of django-x509
when: openwisp2_django_x509_dev
pip:
name: https://github.com/openwisp/django-x509/tarball/master
state: latest
virtualenv: "{{ virtualenv_path }}"
virtualenv_python: "{{ openwisp2_python }}"
virtualenv_site_packages: yes
notify: reload supervisor

- name: Install development version of django-netjsongraph
when: openwisp2_network_topology and openwisp2_django_netjsongraph_dev
pip:
name: https://github.com/netjson/django-netjsongraph/tarball/master
state: latest
virtualenv: "{{ virtualenv_path }}"
virtualenv_python: "{{ openwisp2_python }}"
virtualenv_site_packages: yes
notify: reload supervisor

- name: Install development version of openwisp-network-topology
when: openwisp2_network_topology and openwisp2_network_topology_dev
pip:
name: https://github.com/openwisp/openwisp-network-topology/tarball/master
state: latest
virtualenv: "{{ virtualenv_path }}"
virtualenv_python: "{{ openwisp2_python }}"
virtualenv_site_packages: yes
notify: reload supervisor

- name: Install extra python packages
pip:
Expand Down

0 comments on commit 3151bd0

Please sign in to comment.