We used a similar local role here, in the Freifunk Magdeburg project, and in personal playbooks. That was moved to an external project, unified, and reworked, so the external role can act as replacement for the distributed, redundant copies. Link: https://github.com/netz39/ansible-role-host-docker
34 lines
1.2 KiB
YAML
34 lines
1.2 KiB
YAML
---
|
|
# this is for a dedicated vm just hosting the unifi controller.
|
|
- hosts: unicorn.n39.eu
|
|
become: true
|
|
vars:
|
|
ansible_python_interpreter: /usr/bin/python3
|
|
data_dir: "/srv/data"
|
|
|
|
roles:
|
|
# role 'netz39.host_docker' applied through group 'docker_host'
|
|
|
|
tasks:
|
|
- name: Setup the docker container for unifi-controller
|
|
docker_container:
|
|
name: unifi-controller
|
|
image: jacobalberty/unifi:v9.0.114
|
|
state: started
|
|
restart_policy: unless-stopped
|
|
container_default_behavior: no_defaults
|
|
env:
|
|
TZ: "{{ timezone }}"
|
|
# These fixed ports are needed.
|
|
# https://help.ui.com/hc/en-us/articles/218506997-UniFi-Ports-Used
|
|
ports:
|
|
- "8080:8080/tcp" # Device command/control
|
|
- "8443:8443/tcp" # Web interface + API
|
|
- "8843:8843/tcp" # HTTPS portal
|
|
- "8880:8880/tcp" # HTTP portal
|
|
- "3478:3478/udp" # STUN service
|
|
- "6789:6789/tcp" # Speed Test (unifi5 only)
|
|
- "10001:10001/udp" # Used for device discovery.
|
|
volumes:
|
|
- "{{ data_dir }}/unifi-controller/data:/unifi/data"
|
|
- "{{ data_dir }}/unifi-controller/log:/unifi/log"
|