From 4d44ad017d04b07e5c7284765747cc2b1bc3e1cd Mon Sep 17 00:00:00 2001 From: PurpleNinja225 Date: Sun, 7 Feb 2021 14:38:10 -0900 Subject: [PATCH 1/2] move znc to role --- group_vars/all.yml | 12 ------------ nas.yml | 9 +++++---- roles/znc/defaults/main.yml | 18 ++++++++++++++++++ tasks/znc.yml => roles/znc/tasks/main.yml | 10 ++++++---- 4 files changed, 29 insertions(+), 20 deletions(-) create mode 100644 roles/znc/defaults/main.yml rename tasks/znc.yml => roles/znc/tasks/main.yml (79%) 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" From 097d58f1d743a0e94856007f7f02c9340e0c29f1 Mon Sep 17 00:00:00 2001 From: David Stephens Date: Tue, 9 Feb 2021 22:15:58 +0000 Subject: [PATCH 2/2] Remove explicit network mode --- roles/znc/tasks/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/roles/znc/tasks/main.yml b/roles/znc/tasks/main.yml index 084fa310..1744f8d3 100644 --- a/roles/znc/tasks/main.yml +++ b/roles/znc/tasks/main.yml @@ -15,7 +15,6 @@ volumes: - "{{ znc_data_directory }}:/znc-data:rw" - "/etc/timezone:/etc/timezone:ro" - network_mode: "bridge" ports: - "{{ znc_port }}:6677" env: