created roles and playbooks for schreinerei och.

This commit is contained in:
2026-03-21 14:34:30 +01:00
commit 092e6bc94e
24 changed files with 655 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
# Readme
## General
This playbook will deploy the unifi network application as docker container on the hosts which are speicified in your inventory under the name ````unifi ````
it also changes the way that the unifi network application will be reachable after the deployment. if you set the variable proxy_type in your vars, the default port 8443 will be changed to 18443
## vars
### group vars
unifi_docker_paths:
- /opt/docker/config/unifi
### host vars
unifi_mongo_host:
unifi_mongo_user:
unifi_mongo_user_pass:
unifi_mongo_db_name:

View File

@@ -0,0 +1,31 @@
---
- name: Unifi | create project paths
ansible.builtin.file:
state: directory
path: "{{ item }}"
owner: root
group: root
mode: '0755'
with_items: "{{ unifi_docker_paths }}"
- name: Unifi | copy mongo-init.js
ansible.builtin.template:
src: mongo-init.js.j2
dest: /opt/docker/config/unifi/mongo-init.js
mode: '0644'
- name: Unifi | copy unifi docker-compose.yml
ansible.builtin.template:
src: docker-compose.yml.j2
dest: /opt/docker/config/unifi/docker-compose.yml
mode: '0644'
- name: Unifi | create docker proxy network if not available
community.docker.docker_network:
name: proxy
- name: Unifi | start docker container
community.docker.docker_compose_v2:
project_src: /opt/docker/config/unifi/
state: present

View File

@@ -0,0 +1,63 @@
---
services:
unifi-db:
image: mongo:8.0-rc
container_name: {{ unifi_mongo_host }}
networks:
- unifi-network
volumes:
- db:/data/db
- ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
restart: unless-stopped
unifi-network-application:
image: lscr.io/linuxserver/unifi-network-application:latest
container_name: unifi-network-application
networks:
- unifi-network
{% if proxy_type is defined %}
- proxy
{% endif %}
environment:
- PUID=1000
- PGID=1000
- TZ=Etc/UTC
- MONGO_USER={{ unifi_mongo_user }}
- MONGO_PASS={{ unifi_mongo_user_pass }}
- MONGO_HOST={{ unifi_mongo_host }}
- MONGO_PORT=27017
- MONGO_DBNAME={{ unifi_mongo_db_name }}
volumes:
- config:/config
{% if proxy_type is defined %}
expose:
- 8443
{% endif %}
ports:
{% if proxy_type %}
- 18443:8443
{% else %}
- 8443:8443
{% endif %}
- 3478:3478/udp
- 10001:10001/udp
- 8080:8080
- 1900:1900/udp #optional
- 8843:8843 #optional
- 8880:8880 #optional
- 6789:6789 #optional
- 5514:5514/udp #optional
restart: unless-stopped
networks:
unifi-network:
{% if proxy_type is defined %}
proxy:
external: true
{% endif %}
volumes:
config:
driver: local
db:
driver: local

View File

@@ -0,0 +1,2 @@
db.getSiblingDB("{{ unifi_mongo_db_name }}").createUser({user: '{{ unifi_mongo_user }}', pwd: '{{ unifi_mongo_user_pass }}', roles: [{role: "dbOwner", db: "{{ unifi_mongo_db_name }}"}]});
db.getSiblingDB("{{ unifi_mongo_db_name }}_stat").createUser({user: '{{ unifi_mongo_user }}', pwd: '{{ unifi_mongo_user_pass }}', roles: [{role: "dbOwner", db: "{{ unifi_mongo_db_name }}_stat"}]});