Compare commits

..

No commits in common. "main" and "server-v9" have entirely different histories.

7 changed files with 36 additions and 114 deletions

View File

@ -1,23 +1,3 @@
## **1.1.3**&emsp;<sub><sup>2025-01-08 (9e5403f5ea77b2a2583799b27c9318d79e54c19e...9e5403f5ea77b2a2583799b27c9318d79e54c19e)</sup></sub>
### Bug Fixes
- Fix errorneous mongo configuration (9e5403f5ea77b2a2583799b27c9318d79e54c19e)
<br>
## **v1.1.2**&emsp;<sub><sup>2025-01-08 (87ead41f5e65ec7beca3e1ab3e01e1a5dc5c17c1...debb1f9e6395a022a53630b5d95686235f23c1ca)</sup></sub>
### Bug Fixes
- Use the variable container name (d4291453cc1c3092db8eaf4fc4fc8db8d4550986)
### Merges
- pull request 'server\-v9' \(\#1\) from server\-v9 into main (debb1f9e6395a022a53630b5d95686235f23c1ca)
<br>
# Changelog
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

View File

@ -1,9 +1,8 @@
---
## General
unifi_image_unifi: lscr.io/linuxserver/unifi-network-application:latest
unifi_image_mongodb: docker.io/mongo:3.6
unifi_container_name_unifi: unifi-network-application
unifi_image: lscr.io/linuxserver/unifi-network-application:latest
unifi_container_name: unifi-network-application
unifi_uid: 1000
unifi_gid: 1000
@ -25,39 +24,28 @@ unifi_http_port_8880: 8880
unifi_http_port_6789: 6789
unifi_http_port_5514: 5514
unifi_server_enabled: true
unifi_mongo_local: true
unifi_mongo_user: unifi
unifi_mongo_pass: unifi
unifi_mongo_host: "unifi-db"
unifi_mongo_pass:
unifi_mongo_host: unifi-db
unifi_mongo_port: 27017
unifi_mongo_db_name: unifi-db
unifi_mongo_auth_source:
unifi_nongo_db_name: unifi
unifi_mongo_auth_source: admin
unifi_mongo_tls:
# Unifi-Controller paths
unifi_root_path: /var/local
unifi_config_path: "{{ unifi_root_path }}/conf/unifi-network-application"
unifi_data_base: "{{ unifi_root_path }}/unifi-network-application/unifi"
unifi_mongodb_path: "{{ unifi_data_base }}/unifi-db"
unifi_network_application_path: "{{ unifi_data_base }}/unifi-network-application"
unifi_data_base: "{{ unifi_root_path }}/unifi-controller"
unifi_config_path: "{{ unifi_root_path }}/conf/unifi-controller"
# Add other paths here to make sure they're created automatically
#
unifi_skeleton_paths:
- "{{ unifi_config_path }}"
- "{{ unifi_data_base }}"
- "{{ unifi_mongodb_path }}"
- "{{ unifi_network_application_path }}"
# Add more templates to be copied into the config
unifi_configuration_files:
- ["docker-compose.yml", "0640"]
- ["env.unifi-controller.conf", "0640"]
- ["env.mongodb.conf", "0640"]
- ["init-mongo.js", "0644"]
- "docker-compose.yml"
- "env.unifi-controller.conf"
# Documentation
unifi_documentation_link: "https://www.laurivan.com"

View File

@ -1,39 +1,22 @@
---
- name: "UNIFI-CONTROLLER | Check existing directories"
ansible.builtin.stat:
path: "{{ item }}"
register: unifi_folder_stats
with_items:
- "{{ unifi_skeleton_paths }}"
tags:
- unifi_configure
become: true
- name: "UNIFI-CONTROLLER | Print scanned dirs"
ansible.builtin.debug:
msg: "Scanned: {{ item }}"
loop: "{{ unifi_folder_stats.results | map(attribute='item') | list }}"
- name: "UNIFI-CONTROLLER | Set up directories if they don't exist"
- name: "UNIFI-CONTROLLER | Set up directories"
ansible.builtin.file:
state: directory
path: "{{ item.invocation.module_args.path }}"
path: "{{ item }}"
owner: "{{ ansible_effective_user_id }}"
group: "{{ ansible_effective_group_id }}"
mode: "0750"
loop: "{{ unifi_folder_stats.results }}"
loop_control:
label: "{{ item.invocation.module_args.path }}"
when: not item.stat.exists
with_items:
- "{{ unifi_skeleton_paths }}"
tags:
- unifi_configure
become: true
- name: "UNIFI-CONTROLLER | Write configuration files"
ansible.builtin.template:
src: "{{ item[0] }}.j2"
dest: "{{ unifi_config_path | expanduser | realpath }}/{{ item[0] }}"
mode: "{{ item[1] }}"
src: "{{ item }}.j2"
dest: "{{ unifi_config_path | expanduser | realpath }}/{{ item }}"
mode: '0640'
with_items:
- "{{ unifi_configuration_files }}"
tags:

View File

@ -1,29 +1,10 @@
# unifi-network-app docker compose
# unifi-controller docker compose
---
version: '3.9'
services:
{% if unifi_mongo_local %}
unifi-db:
container_name: unifi-db
image: "{{ unifi_image_mongodb }}"
env_file:
- "{{ unifi_config_path | expanduser }}/env.mongodb.conf"
ports:
- target: 27017
published: "27017"
protocol: tcp
restart: unless-stopped
volumes:
- "{{ unifi_config_path | expanduser }}/init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js"
- type: bind
source: "{{ unifi_mongodb_path }}"
target: /data/db
networks:
- unifi-bridge
{% endif %}
{% if unifi_server_enabled %}
unifi-controller:
image: "{{ unifi_image_unifi }}"
container_name: "{{ unifi_container_name_unifi }}"
image: "{{ unifi_image }}"
container_name: "{{ unifi_container_name }}"
restart: unless-stopped
env_file:
- "{{ unifi_config_path | expanduser }}/env.unifi-controller.conf"
@ -32,31 +13,29 @@ services:
- "{{ unifi_http_port_3478 }}:3478/udp"
- "{{ unifi_http_port_10001 }}:10001/udp"
- "{{ unifi_http_port_8080 }}:8080"
{% if unifi_http_port_1900 is defined and unifi_http_port_1900 -%}
{% if unifi_http_port_1900 is defined -%}
- "{{ unifi_http_port_1900 }}:1900/udp"
{% endif -%}
{% if unifi_http_port_8843 is defined and unifi_http_port_8843 -%}
{% if unifi_http_port_8843 is defined -%}
- "{{ unifi_http_port_8843 }}:8843"
{% endif -%}
{% if unifi_http_port_8880 is defined and unifi_http_port_8880 -%}
{% if unifi_http_port_8880 is defined -%}
- "{{ unifi_http_port_8880 }}:8880"
{% endif -%}
{% if unifi_http_port_6789 is defined and unifi_http_port_6789 -%}
{% if unifi_http_port_6789 is defined -%}
- "{{ unifi_http_port_6789 }}:6789"
{% endif -%}
{% if unifi_http_port_5514 is defined and unifi_http_port_5514 -%}
{% if unifi_http_port_5514 is defined -%}
- "{{ unifi_http_port_5514 }}:5514/udp"
{% endif %}
networks:
- unifi-bridge
- unifi-controller-net
volumes:
- type: bind
source: "{{ unifi_network_application_path }}"
target: /config
{% endif %}
- "{{ unifi_volume }}:/config"
volumes:
{{ unifi_volume }}:
networks:
unifi-bridge:
driver: bridge
unifi-controller-net: {}

View File

@ -1,3 +0,0 @@
PUID={{ unifi_uid }}
PUID={{ unifi_gid }}
TZ={{ unifi_tz }}

View File

@ -1,21 +1,18 @@
# Add environment variables for unifi-controller here
# Note: This is a .ini file format
PUID={{ unifi_uid }}
GUID={{ unifi_gid }}
PUID={{ unifi_gid }}
MEM_LIMIT={{ unifi_mem_limit }}
MEM_STATUP={{ unifi_mem_startup }}
TZ={{ unifi_tz }}
MONGO_USER={{ unifi_mongo_user }}
{% if unifi_mongo_pass is defined and unifi_mongo_pass -%}
MONGO_PASS={{ unifi_mongo_pass }}
{% endif %}
MONGO_HOST={{ unifi_mongo_host }}
MONGO_PORT={{ unifi_mongo_port }}
MONGO_DBNAME={{ unifi_mongo_db_name }}
{% if unifi_mongo_auth_source is defined and unifi_mongo_auth_source -%}
MONGO_DBNAME={{ unifi_nongo_db_name }}
MONGO_AUTHSOURCE={{ unifi_mongo_auth_source }}
{% endif %}
{% if unifi_mongo_tls is defined and unifi_mongo_tls -%}
{% if unifi_mongo_tls is defined -%}
MONGO_TLS= {{ unifi_mongo_tls }}
{% endif %}

View File

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