6 Commits

Author SHA1 Message Date
d4291453cc fix: Use the variable container name 2025-01-08 09:41:55 +01:00
87ead41f5e chore: Update unifi controller.
Add conventional commits.
2025-01-08 09:26:38 +01:00
d9d757bdc0 chore(release): 1.1.1 2023-09-21 16:41:32 +02:00
28c32a767f fix: Linting. 2023-09-21 15:39:23 +02:00
4ea9fd1142 chore: Typo. 2023-09-21 15:16:41 +02:00
fb5c9425e9 chore(release): 1.0.0 2023-09-21 15:15:41 +02:00
14 changed files with 88 additions and 71 deletions

View File

@@ -1,10 +1,12 @@
---
exclude_paths:
- .cache/
- ./molecule
- ./.travis.yml
- ./.github
parseable: true
skip_list:
- '204'
- 'no-handler'
use_default_rules: true
verbosity: 1

View File

@@ -2,6 +2,15 @@
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)

View File

@@ -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.

View File

@@ -1,12 +1,14 @@
---
## General
unifi_image: lscr.io/linuxserver/unifi-controller:latest
unifi_image: lscr.io/linuxserver/unifi-network-application:latest
unifi_container_name: 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,6 +24,13 @@ unifi_http_port_8880: 8880
unifi_http_port_6789: 6789
unifi_http_port_5514: 5514
unifi_mongo_user: unifi
unifi_mongo_pass:
unifi_mongo_host: unifi-db
unifi_mongo_port: 27017
unifi_nongo_db_name: unifi
unifi_mongo_auth_source: admin
unifi_mongo_tls:
# Unifi-Controller paths
unifi_root_path: /var/local
@@ -33,7 +42,7 @@ unifi_config_path: "{{ unifi_root_path }}/conf/unifi-controller"
unifi_skeleton_paths:
- "{{ unifi_config_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"

View 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%

View File

@@ -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."

View File

@@ -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"

View File

@@ -1,4 +1,4 @@
---
roles:
- "geerlingguy.docker"
- name: "geerlingguy.docker"
collections: []

View File

@@ -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 }}"

View File

@@ -15,10 +15,9 @@
- name: "UNIFI-CONTROLLER | Write configuration files"
ansible.builtin.template:
src: "{{ item }}.j2"
dest: "{{ unifi_config_path | expanduser | realpath }}/{{ item }}"
dest: "{{ unifi_config_path | expanduser | realpath }}/{{ item }}"
mode: '0640'
with_items:
- "{{ unifi_configuration_files }}"
tags:
- unifi_configure

View File

@@ -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

View File

@@ -1,9 +1,10 @@
# unifi-controller docker compose
---
version: '3.9'
services:
unifi-controller:
image: "{{ unifi_image }}"
container_name: unifi-controller-service
container_name: "{{ unifi_container_name }}"
restart: unless-stopped
env_file:
- "{{ unifi_config_path | expanduser }}/env.unifi-controller.conf"

View File

@@ -5,4 +5,16 @@ PUID={{ unifi_gid }}
MEM_LIMIT={{ unifi_mem_limit }}
MEM_STATUP={{ unifi_mem_startup }}
TZ={{ unifi_tz }}
MONGO_USER={{ unifi_mongo_user }}
MONGO_PASS={{ unifi_mongo_pass }}
MONGO_HOST={{ unifi_mongo_host }}
MONGO_PORT={{ unifi_mongo_port }}
MONGO_DBNAME={{ unifi_nongo_db_name }}
MONGO_AUTHSOURCE={{ unifi_mongo_auth_source }}
{% if unifi_mongo_tls is defined -%}
MONGO_TLS= {{ unifi_mongo_tls }}
{% endif %}

View File

@@ -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