From e8c96ae6dc34d5e87511145b269aa88059779de7 Mon Sep 17 00:00:00 2001 From: owine Date: Sun, 26 Nov 2023 14:24:23 -0600 Subject: [PATCH] Unifi: Deprecate --- roles/unifi/defaults/main.yml | 163 ------------------------- roles/unifi/tasks/main.yml | 39 +----- roles/unifi/templates/init-mongo.js.j2 | 1 - 3 files changed, 5 insertions(+), 198 deletions(-) delete mode 100644 roles/unifi/defaults/main.yml delete mode 100644 roles/unifi/templates/init-mongo.js.j2 diff --git a/roles/unifi/defaults/main.yml b/roles/unifi/defaults/main.yml deleted file mode 100644 index b6cc506f28..0000000000 --- a/roles/unifi/defaults/main.yml +++ /dev/null @@ -1,163 +0,0 @@ -######################################################################### -# Title: Sandbox: Unifi | Default Variables # -# Author(s): Grostim # -# URL: https://github.com/saltyorg/Sandbox # -# -- # -######################################################################### -# GNU General Public License v3.0 # -######################################################################### ---- -################################ -# Basics -################################ - -unifi_name: unifi - -################################ -# Settings -################################ - -unifi_mongo_user: "unifi" -unifi_mongo_pass: "password4321" -unifi_mongo_port: "27017" -unifi_mongo_dbname: "unifi" - -################################ -# Paths -################################ - -unifi_paths_folder: "{{ unifi_name }}" -unifi_paths_location: "{{ server_appdata_path }}/{{ unifi_paths_folder }}" -unifi_paths_folders_list: - - "{{ unifi_paths_location }}" - -################################ -# Web -################################ - -unifi_web_subdomain: "{{ unifi_name }}" -unifi_web_domain: "{{ user.domain }}" -unifi_web_port: "8443" -unifi_web_scheme: "https" -unifi_web_serverstransport: "skipverify@file" -unifi_web_url: "{{ 'https://' + (unifi_web_subdomain + '.' + unifi_web_domain - if (unifi_web_subdomain | length > 0) - else unifi_web_domain) }}" - -################################ -# DNS -################################ - -unifi_dns_record: "{{ unifi_web_subdomain }}" -unifi_dns_zone: "{{ unifi_web_domain }}" -unifi_dns_proxy: "{{ dns.proxied }}" - -################################ -# Traefik -################################ - -unifi_traefik_sso_middleware: "" -unifi_traefik_middleware_default: "{{ traefik_default_middleware }}" -unifi_traefik_middleware_custom: "" -unifi_traefik_certresolver: "{{ traefik_default_certresolver }}" -unifi_traefik_enabled: true -unifi_traefik_api_enabled: false -unifi_traefik_api_endpoint: "" - -################################ -# Docker -################################ - -# Container -unifi_docker_container: "{{ unifi_name }}" - -# Image -unifi_docker_image_pull: true -unifi_docker_image_tag: "latest" -unifi_docker_image_repo: "lscr.io/linuxserver/unifi-network-application" -unifi_docker_image: "{{ unifi_docker_image_repo }}:{{ unifi_docker_image_tag }}" - -# Ports -unifi_docker_ports_defaults: - - "8080:8080/tcp" - - "3478:3478/udp" - - "10001:10001/udp" -unifi_docker_ports_custom: [] -unifi_docker_ports: "{{ unifi_docker_ports_defaults - + unifi_docker_ports_custom }}" - -# Envs -unifi_docker_envs_default: - PUID: "{{ uid }}" - PGID: "{{ gid }}" - TZ: "{{ tz }}" - MONGO_USER: "{{ unifi_mongo_user }}" - MONGO_PASS: "{{ unifi_mongo_pass }}" - MONGO_HOST: "{{ unifi_name }}_mongo" - MONGO_PORT: "{{ unifi_mongo_port }}" - MONGO_DBNAME: "{{ unifi_mongo_dbname }}" -unifi_docker_envs_custom: {} -unifi_docker_envs: "{{ unifi_docker_envs_default - | combine(unifi_docker_envs_custom) }}" - -# Commands -unifi_docker_commands_default: [] -unifi_docker_commands_custom: [] -unifi_docker_commands: "{{ unifi_docker_commands_default - + unifi_docker_commands_custom }}" - -# Volumes -unifi_docker_volumes_default: - - "{{ unifi_paths_location }}:/config" -unifi_docker_volumes_custom: [] -unifi_docker_volumes: "{{ unifi_docker_volumes_default - + unifi_docker_volumes_custom }}" - -# Devices -unifi_docker_devices_default: [] -unifi_docker_devices_custom: [] -unifi_docker_devices: "{{ unifi_docker_devices_default - + unifi_docker_devices_custom }}" - -# Hosts -unifi_docker_hosts_default: [] -unifi_docker_hosts_custom: [] -unifi_docker_hosts: "{{ docker_hosts_common - | combine(unifi_docker_hosts_default) - | combine(unifi_docker_hosts_custom) }}" - -# Labels -unifi_docker_labels_default: {} -unifi_docker_labels_custom: {} -unifi_docker_labels: "{{ docker_labels_common - | combine(unifi_docker_labels_default) - | combine(unifi_docker_labels_custom) }}" - -# Hostname -unifi_docker_hostname: "{{ unifi_name }}" - -# Networks -unifi_docker_networks_alias: "{{ unifi_name }}" -unifi_docker_networks_default: [] -unifi_docker_networks_custom: [] -unifi_docker_networks: "{{ docker_networks_common - + unifi_docker_networks_default - + unifi_docker_networks_custom }}" - -# Capabilities -unifi_docker_capabilities_default: [] -unifi_docker_capabilities_custom: [] -unifi_docker_capabilities: "{{ unifi_docker_capabilities_default - + unifi_docker_capabilities_custom }}" - -# Security Opts -unifi_docker_security_opts_default: [] -unifi_docker_security_opts_custom: [] -unifi_docker_security_opts: "{{ unifi_docker_security_opts_default - + unifi_docker_security_opts_custom }}" - -# Restart Policy -unifi_docker_restart_policy: unless-stopped - -# State -unifi_docker_state: started diff --git a/roles/unifi/tasks/main.yml b/roles/unifi/tasks/main.yml index 445f06845c..3b3a1cbfb7 100644 --- a/roles/unifi/tasks/main.yml +++ b/roles/unifi/tasks/main.yml @@ -1,5 +1,5 @@ ######################################################################### -# Title: Sandbox: Unifi # +# Title: Sandbox: Unifi Network Controller (Deprecated) # # Author(s): Grostim # # URL: https://github.com/saltyorg/Sandbox # # -- # @@ -7,36 +7,7 @@ # GNU General Public License v3.0 # ######################################################################### --- -- name: Add DNS record - ansible.builtin.include_tasks: "{{ resources_tasks_path }}/dns/tasker.yml" - vars: - dns_record: "{{ lookup('vars', role_name + '_dns_record') }}" - dns_zone: "{{ lookup('vars', role_name + '_dns_zone') }}" - dns_proxy: "{{ lookup('vars', role_name + '_dns_proxy') }}" - -- name: Remove existing Docker container - ansible.builtin.include_tasks: "{{ resources_tasks_path }}/docker/remove_docker_container.yml" - -- name: Create directories - ansible.builtin.include_tasks: "{{ resources_tasks_path }}/directories/create_directories.yml" - -- name: "Unifi | Import init-mongo.js" - ansible.builtin.template: - src: init-mongo.js.j2 - dest: '{{ unifi_paths_location }}/init-mongo.js' - owner: "{{ user.name }}" - group: "{{ user.name }}" - mode: "0775" - force: yes - -- name: MongoDB Role - ansible.builtin.include_role: - name: mongodb - vars: - mongodb_instances: ["{{ unifi_name }}_mongo"] - mongodb_paths_location: "{{ server_appdata_path }}/{{ unifi_name }}" - mongodb_docker_image_tag: "4.4" - mongodb_docker_volumes_custom: ["/opt/unifi/init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro"] - -- name: Create Docker container - ansible.builtin.include_tasks: "{{ resources_tasks_path }}/docker/create_docker_container.yml" +- name: "Fail with deprecation warning" + ansible.builtin.fail: + msg: "The 'unifi' role which used the 'unifi-controller' image is deprecated in favour of the 'unifi-network-application' role using the 'unifi-network-application' image. If you are using 'unifi' role, perform a full backup of your Unifi Network Application from the Unifi interface. Then run 'sb install sandbox-unifi-network-controller' to deploy the new image and restore the backup when prompted by the setup wizard." + when: not continuous_integration diff --git a/roles/unifi/templates/init-mongo.js.j2 b/roles/unifi/templates/init-mongo.js.j2 deleted file mode 100644 index 8525f24232..0000000000 --- a/roles/unifi/templates/init-mongo.js.j2 +++ /dev/null @@ -1 +0,0 @@ -db.getSiblingDB("{{ unifi_mongo_dbname }}").createUser({user: "{{ unifi_mongo_user }}", pwd: "{{ unifi_mongo_pass }}", roles: [{role: "dbOwner", db: "{{ unifi_mongo_dbname }}"}, {role: "dbOwner", db: "{{ unifi_mongo_dbname }}_stat"}]}); \ No newline at end of file