This guide provides an Ansible playbook to install OpenWISP using Docker Compose for Debian 10+, Ubuntu LTS, and RHEL 9+ compatible systems.
- name: Install OpenWISP
hosts: openwisp
become: true
vars:
openwisp_dir: /opt/openwisp
openwisp_version: latest
tasks:
- name: Create OpenWISP directory
file:
path: "{{ openwisp_dir }}"
state: directory
mode: "0755"
- name: Create docker-compose.yml
copy:
dest: "{{ openwisp_dir }}/docker-compose.yml"
content: |
services:
openwisp-controller:
image: openwisp/openwisp-controller:{{ openwisp_version }}
ports:
- "8000:8000"
environment:
- DJANGO_SETTINGS_MODULE=openwisp.settings
- DATABASE_URL=postgres://openwisp:openwisp@db:5432/openwisp
depends_on:
- db
- redis
volumes:
- ./static:/opt/openwisp/static
db:
image: postgres:15
environment:
- POSTGRES_DB=openwisp
- POSTGRES_USER=openwisp
- POSTGRES_PASSWORD=openwisp
volumes:
- postgres_data:/var/lib/postgresql/data
redis:
image: redis:alpine
volumes:
postgres_data:
- name: Start OpenWISP containers
community.docker.docker_compose:
project_src: "{{ openwisp_dir }}"
state: present
- name: Verify OpenWISP is running
uri:
url: http://localhost:8000
status_code: [200, 301, 302]
register: result
until: result.status == 200 or result.status == 301 or result.status == 302
retries: 10
delay: 5
failed_when: false
openwisp/openwisp-controller Docker imageAny questions?
Feel free to contact us. Find all contact information on our contact page.