Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c1a0f9b7a5 | |||
| 9e5403f5ea | |||
| aeb42d9ce7 | |||
| debb1f9e63 | |||
| d4291453cc | |||
| 87ead41f5e | |||
| d9d757bdc0 | |||
| 28c32a767f | |||
| 4ea9fd1142 |
@@ -1,10 +1,12 @@
|
||||
---
|
||||
exclude_paths:
|
||||
- .cache/
|
||||
- ./molecule
|
||||
- ./.travis.yml
|
||||
- ./.github
|
||||
parseable: true
|
||||
skip_list:
|
||||
- '204'
|
||||
- 'no-handler'
|
||||
use_default_rules: true
|
||||
verbosity: 1
|
||||
|
||||
27
CHANGELOG.md
27
CHANGELOG.md
@@ -1,7 +1,34 @@
|
||||
## **1.1.3** <sub><sup>2025-01-08 (9e5403f5ea77b2a2583799b27c9318d79e54c19e...9e5403f5ea77b2a2583799b27c9318d79e54c19e)</sup></sub>
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Fix errorneous mongo configuration (9e5403f5ea77b2a2583799b27c9318d79e54c19e)
|
||||
|
||||
<br>
|
||||
|
||||
## **v1.1.2** <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.
|
||||
|
||||
### [1.1.1](https://git.laurivan.com/Dev/ansible-role-unifi-controller/compare/v1.0.0...v1.1.1) (2023-09-21)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Linting. ([28c32a7](https://git.laurivan.com/Dev/ansible-role-unifi-controller/commit/28c32a767f98bca403abedfdfe3e38ca9b665c31))
|
||||
|
||||
## [1.0.0](https://git.laurivan.com/Dev/ansible-role-unifi-controller/compare/v1.1.0...v1.0.0) (2023-09-21)
|
||||
|
||||
## 1.1.0 (2023-09-21)
|
||||
|
||||
@@ -47,7 +47,6 @@ The following fields are internal. You can change them to further customise how
|
||||
- `unifi_skeleton_paths`: The list of paths to be created by the role
|
||||
- `unifi_configuration_files`: The configuration files generated by the role
|
||||
|
||||
|
||||
## Dependencies
|
||||
|
||||
You need a machine with docker and docker-compose installed.
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
---
|
||||
|
||||
## General
|
||||
unifi_image: lscr.io/linuxserver/unifi-controller:latest
|
||||
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_uid: 1000
|
||||
unifi_gid: 1000
|
||||
unifi_mem_limit: 1024
|
||||
unifi_mem_startup: 1024
|
||||
unifi_tz: "Etc/UTC"
|
||||
|
||||
unifi_volume: "unifi"
|
||||
|
||||
@@ -22,21 +25,39 @@ 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_port: 27017
|
||||
unifi_mongo_db_name: unifi-db
|
||||
unifi_mongo_auth_source:
|
||||
unifi_mongo_tls:
|
||||
|
||||
# Unifi-Controller paths
|
||||
unifi_root_path: /var/local
|
||||
unifi_data_base: "{{ unifi_root_path }}/unifi-controller"
|
||||
unifi_config_path: "{{ unifi_root_path }}/conf/unifi-controller"
|
||||
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"
|
||||
|
||||
|
||||
|
||||
# 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
|
||||
# Add more templates to be copied into the config
|
||||
unifi_configuration_files:
|
||||
- "docker-compose.yml"
|
||||
- "env.unifi-controller.conf"
|
||||
- ["docker-compose.yml", "0640"]
|
||||
- ["env.unifi-controller.conf", "0640"]
|
||||
- ["env.mongodb.conf", "0640"]
|
||||
- ["init-mongo.js", "0644"]
|
||||
|
||||
# Documentation
|
||||
unifi_documentation_link: "https://www.laurivan.com"
|
||||
|
||||
43
git-conventional-commits.yaml
Normal file
43
git-conventional-commits.yaml
Normal file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
convention:
|
||||
commitTypes:
|
||||
- feat
|
||||
- fix
|
||||
- perf
|
||||
- refactor
|
||||
- style
|
||||
- test
|
||||
- build
|
||||
- ops
|
||||
- docs
|
||||
- chore
|
||||
- merge
|
||||
- revert
|
||||
commitScopes: []
|
||||
releaseTagGlobPattern: v[0-9]*.[0-9]*.[0-9]*
|
||||
changelog:
|
||||
commitTypes:
|
||||
- feat
|
||||
- fix
|
||||
- perf
|
||||
- merge
|
||||
includeInvalidCommits: true
|
||||
commitIgnoreRegexPattern: "^WIP "
|
||||
headlines:
|
||||
feat: Features
|
||||
fix: Bug Fixes
|
||||
perf: Performance Improvements
|
||||
merge: Merges
|
||||
breakingChange: BREAKING CHANGES
|
||||
|
||||
## GitHub
|
||||
# commitUrl: https://github.com/ACCOUNT/REPOSITORY/commit/%commit%
|
||||
# commitRangeUrl: https://github.com/ACCOUNT/REPOSITORY/compare/%from%...%to%?diff=split
|
||||
|
||||
## GitHub Issues
|
||||
# issueRegexPattern: "#[0-9]+"
|
||||
# issueUrl: https://github.com/ACCOUNT/REPOSITORY/issues/%issue%
|
||||
|
||||
## Jira Issues
|
||||
# issueRegexPattern: "[A-Z][A-Z0-9]+-[0-9]+"
|
||||
# issueUrl: https://WORKSPACE.atlassian.net/browse/%issue%
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
- name: "UNIFI-CONTROLLER | Check if the docker-compose file exists."
|
||||
ansible.builtin.stat:
|
||||
path: "{{ unifi_config_path | expanduser | realpath }}/docker-compose.yml"
|
||||
path: "{{ unifi_config_path | expanduser | realpath }}/docker-compose.yml"
|
||||
register: "docker_compose_file"
|
||||
|
||||
- name: "UNIFI-CONTROLLER | Remove docker-compose."
|
||||
|
||||
@@ -21,7 +21,9 @@
|
||||
when: "not docker_sock_stat.stat.exists"
|
||||
|
||||
- name: "UNIFI-CONTROLLER | Update apt cache."
|
||||
ansible.builtin.apt: update_cache=yes cache_valid_time=600
|
||||
ansible.builtin.apt:
|
||||
update_cache: yes
|
||||
cache_valid_time: 600
|
||||
when: "ansible_os_family == 'Debian'"
|
||||
|
||||
- name: "UNIFI-CONTROLLER | Install python requests"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
---
|
||||
roles:
|
||||
- "geerlingguy.docker"
|
||||
- name: "geerlingguy.docker"
|
||||
collections: []
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
---
|
||||
# This is an example playbook to execute goss tests.
|
||||
# Tests need distributed to the appropriate ansible host/groups
|
||||
# prior to execution by `goss validate`.
|
||||
|
||||
- name: Verify unifi-controller
|
||||
hosts:
|
||||
- "unifi-controller"
|
||||
become: true
|
||||
vars:
|
||||
goss_version: "v0.3.16"
|
||||
goss_arch: "amd64"
|
||||
goss_dst: "/usr/local/bin/goss"
|
||||
goss_sha256sum: "827e354b48f93bce933f5efcd1f00dc82569c42a179cf2d384b040d8a80bfbfb"
|
||||
goss_url: "https://github.com/aelsabbahy/goss/releases/download/{{ goss_version }}/goss-linux-{{ goss_arch }}"
|
||||
goss_test_directory:" /tmp"
|
||||
goss_format: "documentation"
|
||||
|
||||
vars_files:
|
||||
- ../../defaults/main.yml
|
||||
|
||||
tasks:
|
||||
- name: "UNIFI-CONTROLLER | Download and install Goss"
|
||||
get_url:
|
||||
url: "{{ goss_url }}"
|
||||
dest: "{{ goss_dst }}"
|
||||
checksum: "sha256:{{ goss_sha256sum }}"
|
||||
mode: 0755
|
||||
register: "download_goss"
|
||||
until: "download_goss is succeeded"
|
||||
retries: 3
|
||||
|
||||
- name: "UNIFI-CONTROLLER | Copy Goss tests to remote"
|
||||
template:
|
||||
src: "{{ item }}"
|
||||
dest: "{{ goss_test_directory }}/{{ item | basename }}"
|
||||
with_fileglob:
|
||||
- "tests/test_*.yml"
|
||||
|
||||
- name: "UNIFI-CONTROLLER | Register test files"
|
||||
shell: "ls {{ goss_test_directory }}/test_*.yml"
|
||||
register: "test_files"
|
||||
|
||||
- name: "UNIFI-CONTROLLER | Execute Goss tests"
|
||||
command: "{{ goss_dst }} -g {{ item }} validate --format {{ goss_format }}"
|
||||
register: "test_results"
|
||||
with_items: "{{ test_files.stdout_lines }}"
|
||||
ignore_errors: true
|
||||
|
||||
- name: "UNIFI-CONTROLLER | Display details about the Goss results"
|
||||
debug:
|
||||
msg: "{{ item.stdout_lines }}"
|
||||
with_items: "{{ test_results.results }}"
|
||||
|
||||
- name: "UNIFI-CONTROLLER | Fail when tests fail"
|
||||
fail:
|
||||
msg: "Goss failed to validate"
|
||||
when: item.rc != 0
|
||||
with_items: "{{ test_results.results }}"
|
||||
@@ -1,24 +1,40 @@
|
||||
---
|
||||
- name: "UNIFI-CONTROLLER | Set up directories"
|
||||
- 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"
|
||||
ansible.builtin.file:
|
||||
state: directory
|
||||
path: "{{ item }}"
|
||||
path: "{{ item.invocation.module_args.path }}"
|
||||
owner: "{{ ansible_effective_user_id }}"
|
||||
group: "{{ ansible_effective_group_id }}"
|
||||
mode: "0750"
|
||||
with_items:
|
||||
- "{{ unifi_skeleton_paths }}"
|
||||
loop: "{{ unifi_folder_stats.results }}"
|
||||
loop_control:
|
||||
label: "{{ item.invocation.module_args.path }}"
|
||||
when: not item.stat.exists
|
||||
tags:
|
||||
- unifi_configure
|
||||
become: true
|
||||
|
||||
- name: "UNIFI-CONTROLLER | Write configuration files"
|
||||
ansible.builtin.template:
|
||||
src: "{{ item }}.j2"
|
||||
dest: "{{ unifi_config_path | expanduser | realpath }}/{{ item }}"
|
||||
mode: '0640'
|
||||
src: "{{ item[0] }}.j2"
|
||||
dest: "{{ unifi_config_path | expanduser | realpath }}/{{ item[0] }}"
|
||||
mode: "{{ item[1] }}"
|
||||
with_items:
|
||||
- "{{ unifi_configuration_files }}"
|
||||
tags:
|
||||
- unifi_configure
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
---
|
||||
|
||||
- name: "UNIFI-CONTROLLER | Configure"
|
||||
import_tasks: config.yml
|
||||
ansible.builtin.import_tasks: config.yml
|
||||
tags:
|
||||
- unifi_configure
|
||||
|
||||
- name: "UNIFI-CONTROLLER | Install"
|
||||
import_tasks: install.yml
|
||||
ansible.builtin.import_tasks: install.yml
|
||||
tags:
|
||||
- unifi_install
|
||||
|
||||
@@ -1,9 +1,29 @@
|
||||
# unifi-controller docker compose
|
||||
version: '3.9'
|
||||
# unifi-network-app docker compose
|
||||
---
|
||||
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 }}"
|
||||
container_name: unifi-controller-service
|
||||
image: "{{ unifi_image_unifi }}"
|
||||
container_name: "{{ unifi_container_name_unifi }}"
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
- "{{ unifi_config_path | expanduser }}/env.unifi-controller.conf"
|
||||
@@ -12,29 +32,31 @@ 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 -%}
|
||||
{% if unifi_http_port_1900 is defined and unifi_http_port_1900 -%}
|
||||
- "{{ unifi_http_port_1900 }}:1900/udp"
|
||||
{% endif -%}
|
||||
{% if unifi_http_port_8843 is defined -%}
|
||||
{% if unifi_http_port_8843 is defined and unifi_http_port_8843 -%}
|
||||
- "{{ unifi_http_port_8843 }}:8843"
|
||||
{% endif -%}
|
||||
{% if unifi_http_port_8880 is defined -%}
|
||||
{% if unifi_http_port_8880 is defined and unifi_http_port_8880 -%}
|
||||
- "{{ unifi_http_port_8880 }}:8880"
|
||||
{% endif -%}
|
||||
{% if unifi_http_port_6789 is defined -%}
|
||||
{% if unifi_http_port_6789 is defined and unifi_http_port_6789 -%}
|
||||
- "{{ unifi_http_port_6789 }}:6789"
|
||||
{% endif -%}
|
||||
{% if unifi_http_port_5514 is defined -%}
|
||||
{% if unifi_http_port_5514 is defined and unifi_http_port_5514 -%}
|
||||
- "{{ unifi_http_port_5514 }}:5514/udp"
|
||||
{% endif %}
|
||||
|
||||
networks:
|
||||
- unifi-controller-net
|
||||
- unifi-bridge
|
||||
volumes:
|
||||
- "{{ unifi_volume }}:/config"
|
||||
|
||||
volumes:
|
||||
{{ unifi_volume }}:
|
||||
- type: bind
|
||||
source: "{{ unifi_network_application_path }}"
|
||||
target: /config
|
||||
{% endif %}
|
||||
|
||||
networks:
|
||||
unifi-controller-net: {}
|
||||
unifi-bridge:
|
||||
driver: bridge
|
||||
|
||||
|
||||
3
templates/env.mongodb.conf.j2
Normal file
3
templates/env.mongodb.conf.j2
Normal file
@@ -0,0 +1,3 @@
|
||||
PUID={{ unifi_uid }}
|
||||
PUID={{ unifi_gid }}
|
||||
TZ={{ unifi_tz }}
|
||||
@@ -1,8 +1,23 @@
|
||||
# Add environment variables for unifi-controller here
|
||||
# Note: This is a .ini file format
|
||||
PUID={{ unifi_uid }}
|
||||
PUID={{ unifi_gid }}
|
||||
GUID={{ unifi_gid }}
|
||||
MEM_LIMIT={{ unifi_mem_limit }}
|
||||
MEM_STATUP={{ unifi_mem_startup }}
|
||||
|
||||
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_AUTHSOURCE={{ unifi_mongo_auth_source }}
|
||||
{% endif %}
|
||||
{% if unifi_mongo_tls is defined and unifi_mongo_tls -%}
|
||||
MONGO_TLS= {{ unifi_mongo_tls }}
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
||||
|
||||
2
templates/init-mongo.js.j2
Normal file
2
templates/init-mongo.js.j2
Normal file
@@ -0,0 +1,2 @@
|
||||
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"}]});
|
||||
@@ -3,5 +3,5 @@ ansible==8.3.0
|
||||
molecule==6.0.2
|
||||
docker==6.1.3
|
||||
molecule-docker==2.1.0
|
||||
ansible-lint==6.19.0
|
||||
ansible-lint==6.20.0
|
||||
yamllint==1.32.0
|
||||
Reference in New Issue
Block a user