Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] Added support for Ubuntu 20.04 (#189) #207

Merged
merged 2 commits into from
Sep 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ env:
- ROLE_NAME: openwisp2
jobs:
- MOLECULE_DISTRO: ubuntu1804
- MOLECULE_DISTRO: ubuntu2004
- MOLECULE_DISTRO: debian10

notifications:
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ From here on you can follow the instructions available at the following sections

**Note:** Please remember to [install ansible](#install-ansible).

**ProTip:** Use `molecule test --destroy=never` to speed up between each run.

All done!

How to run tests
Expand Down
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
openwisp2_python: python3
ansible_python_interpreter: /usr/bin/python3
openwisp2_network_topology: false
openwisp2_controller_version: "0.7.post1"
openwisp2_network_topology_version: "0.4"
Expand Down
1 change: 1 addition & 0 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ galaxy_info:
# https://github.com/openwisp/ansible-openwisp2/issues/169#issuecomment-592983139
# - xenial
- bionic
- focal
# we don't have the resources now to maintain these distros
# - name: Fedora
# versions:
Expand Down
2 changes: 1 addition & 1 deletion molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
openwisp2_network_topology: true

pre_tasks:
- name: Update apt cache.
- name: Update apt cache
apt: update_cache=true cache_valid_time=600
when: ansible_os_family == 'Debian'

Expand Down
49 changes: 21 additions & 28 deletions tasks/apt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,33 @@
- openssl
- libssl-dev
- libffi-dev
- python-dev
- redis-server
- python3
- virtualenv
- cron
notify:
- reload systemd
- start redis
ignore_errors: yes
retries: 5
delay: 10
register: result
until: result is success

- name: Install redis 5 if available
apt:
name: "redis-server=5:5*"
notify:
- reload systemd
- start redis
ignore_errors: yes
register: use_redis5

- name: Install redis 4 (fallback)
when: use_redis5.failed
apt:
name: "redis-server=5:4*"
notify:
- reload systemd
- start redis
ignore_errors: yes

# On the newer versions of redis, by default redis
# binds to localhost on ipv6 address which wouldn't
# let the service start if the server doesn't have
Expand Down Expand Up @@ -91,33 +106,11 @@
until: result is success

- name: Install python3 packages
when: openwisp2_python == "python3"
apt:
name:
- python3
- python3-pip
- python3-dev
- python-virtualenv
retries: 5
delay: 10
register: result
until: result is success

- name: Install python wheel (optional, allowed to fail)
ignore_errors: yes
apt:
name:
- python-wheel
- python3-wheel
retries: 1
delay: 10
register: result
until: result is success

- name: Install python3-virtualenv
ignore_errors: yes
when: ansible_distribution != 'Ubuntu'
apt: name=python3-virtualenv
- python3-virtualenv
retries: 5
delay: 10
register: result
Expand Down
2 changes: 2 additions & 0 deletions tasks/django.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
# sets executable only to directories
mode: u=rwX,g=rX,o=rX
recurse: yes
tags:
- molecule-idempotence-notest

- name: collectstatic
notify: reload supervisor
Expand Down
2 changes: 1 addition & 1 deletion tasks/django_secret_key.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
mode: 0754

- name: generate new django SECRET_KEY
shell: "./generate_django_secret_key.py > .django-secret-key"
shell: "{{ virtualenv_path }}/bin/python ./generate_django_secret_key.py > .django-secret-key"
args:
chdir: "{{ openwisp2_path }}"
creates: "{{ openwisp2_path }}/.django-secret-key"
Expand Down
40 changes: 28 additions & 12 deletions tasks/pip.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
- name: Update pip & related tools
pip:
name:
- pip
- setuptools
- wheel
- attrs
state: latest
virtualenv: "{{ virtualenv_path }}"
virtualenv_python: "{{ openwisp2_python }}"
virtualenv_site_packages: yes
retries: 5
delay: 10
register: result
until: result is success

- name: Remove jsonfield2
pip:
name:
Expand Down Expand Up @@ -36,13 +52,9 @@
- "{{ openwisp2_network_topology_pip }}"
when: item is defined and item is string and openwisp2_network_topology

- name: Update pip & related tools
- name: Install cryptography from pip
pip:
name:
- pip
- setuptools
- wheel
- attrs
name: cryptography
state: latest
virtualenv: "{{ virtualenv_path }}"
virtualenv_python: "{{ openwisp2_python }}"
Expand All @@ -52,29 +64,33 @@
register: result
until: result is success

- name: Install cryptography from pip
- name: Install openwisp2 controller and its dependencies
pip:
name: cryptography
name:
- "openwisp-controller~={{ openwisp2_controller_version }}"
- channels_redis
- service_identity
state: latest
virtualenv: "{{ virtualenv_path }}"
virtualenv_python: "{{ openwisp2_python }}"
virtualenv_site_packages: yes
notify: reload supervisor
retries: 5
delay: 10
register: result
until: result is success
tags:
- molecule-idempotence-notest

- name: Install openwisp2 controller and its dependencies
- name: Pin channels_redis to 2.4 for redis 4 compatibility
when: use_redis5.failed
pip:
name:
- "openwisp-controller~={{ openwisp2_controller_version }}"
- channels_redis~=2.4
- service_identity
state: latest
virtualenv: "{{ virtualenv_path }}"
virtualenv_python: "{{ openwisp2_python }}"
virtualenv_site_packages: yes
notify: reload supervisor
retries: 5
delay: 10
register: result
Expand Down