diff --git a/group_vars/all.yml b/group_vars/all.yml index ea422fcb..2d922f84 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml @@ -51,7 +51,6 @@ timemachine_enabled: false gitlab_enabled: false # IRC -znc_enabled: false thelounge_enabled: false # Finance @@ -326,17 +325,6 @@ youtubedlmaterial_port_http: "8998" ### openvpn_config_directory: "{{ docker_home }}/openvpn" - -### -### ZNC -### -znc_available_externally: "false" -znc_data_directory: "{{ docker_home }}/znc" -znc_user_id: "0" -znc_group_id: "0" -znc_port: "6677" - - ### ### Stats ### diff --git a/nas.yml b/nas.yml index b3d30af3..aab7ea22 100644 --- a/nas.yml +++ b/nas.yml @@ -198,6 +198,11 @@ - watchtower when: (watchtower_enabled | default(False)) + - role: znc + tags: + - znc + when: (znc_enabled | default(False)) + tasks: - import_tasks: tasks/firefly.yml when: (firefly_enabled | default(False)) @@ -219,10 +224,6 @@ when: (glances_enabled | default(False)) tags: glances - - import_tasks: tasks/znc.yml - when: (znc_enabled | default(False)) - tags: znc - - import_tasks: tasks/miniflux.yml when: (miniflux_enabled | default(False)) tags: miniflux diff --git a/roles/znc/defaults/main.yml b/roles/znc/defaults/main.yml new file mode 100644 index 00000000..ec9bb937 --- /dev/null +++ b/roles/znc/defaults/main.yml @@ -0,0 +1,18 @@ +--- +# enable or disable the application +znc_enabled: false +znc_available_externally: "false" + +# directories +znc_data_directory: "{{ docker_home }}/znc" + +# uid / gid +znc_user_id: "0" +znc_group_id: "0" + +# network +znc_hostname: "znc" +znc_port: "6677" + +# specs +znc_memory: "1g" diff --git a/tasks/znc.yml b/roles/znc/tasks/main.yml similarity index 79% rename from tasks/znc.yml rename to roles/znc/tasks/main.yml index 2401b53b..084fa310 100644 --- a/tasks/znc.yml +++ b/roles/znc/tasks/main.yml @@ -3,10 +3,11 @@ file: path: "{{ item }}" state: directory + # mode: 0755 with_items: - "{{ znc_data_directory }}" -- name: ZNC +- name: Create ZNC Docker Container docker_container: name: znc image: znc @@ -14,17 +15,18 @@ volumes: - "{{ znc_data_directory }}:/znc-data:rw" - "/etc/timezone:/etc/timezone:ro" + network_mode: "bridge" ports: - "{{ znc_port }}:6677" env: PUID: "{{ znc_user_id }}" PGID: "{{ znc_group_id }}" restart_policy: unless-stopped - memory: 1g + memory: "{{ znc_memory }}" labels: traefik.enable: "{{ znc_available_externally }}" - traefik.http.routers.znc.rule: "Host(`znc.{{ ansible_nas_domain }}`)" + traefik.http.routers.znc.rule: "Host(`{{ znc_hostname }}.{{ ansible_nas_domain }}`)" traefik.http.routers.znc.tls.certresolver: "letsencrypt" traefik.http.routers.znc.tls.domains[0].main: "{{ ansible_nas_domain }}" traefik.http.routers.znc.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" - traefik.http.services.znc.loadbalancer.server.port: "6677" \ No newline at end of file + traefik.http.services.znc.loadbalancer.server.port: "6677"