From 3657c4feda04317c5f27f85386fd8144a831e060 Mon Sep 17 00:00:00 2001 From: PurpleNinja225 Date: Fri, 29 Jan 2021 00:08:36 -0900 Subject: [PATCH 1/3] Add template mv get_iplayer, nzbget, pyload, tautulli to roles --- group_vars/all.yml | 45 ------------------- nas.yml | 31 +++++++------ roles/application-template/defaults/main.yml | 21 +++++++++ roles/application-template/tasks/main.yml | 36 +++++++++++++++ roles/get-iplayer/defaults/main.yml | 12 +++++ .../get-iplayer/tasks/main.yml | 2 +- roles/nzbget/defaults/main.yml | 18 ++++++++ .../nzbget.yml => roles/nzbget/tasks/main.yml | 2 +- roles/pyload/defaults/main.yml | 19 ++++++++ .../pyload.yml => roles/pyload/tasks/main.yml | 4 +- roles/tautulli/defaults/main.yml | 17 +++++++ .../tautulli/tasks/main.yml | 4 +- 12 files changed, 144 insertions(+), 67 deletions(-) create mode 100644 roles/application-template/defaults/main.yml create mode 100644 roles/application-template/tasks/main.yml create mode 100644 roles/get-iplayer/defaults/main.yml rename tasks/get_iplayer.yml => roles/get-iplayer/tasks/main.yml (93%) create mode 100644 roles/nzbget/defaults/main.yml rename tasks/nzbget.yml => roles/nzbget/tasks/main.yml (90%) create mode 100644 roles/pyload/defaults/main.yml rename tasks/pyload.yml => roles/pyload/tasks/main.yml (88%) create mode 100644 roles/tautulli/defaults/main.yml rename tasks/tautulli.yml => roles/tautulli/tasks/main.yml (87%) diff --git a/group_vars/all.yml b/group_vars/all.yml index 56a35837..279a7a8a 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml @@ -15,15 +15,7 @@ ### Ansible-NAS Applications ### -# Downloading -nzbget_enabled: false -pyload_enabled: false - -# Media Serving -tautulli_enabled: false - # Media Sourcing -get_iplayer_enabled: false jackett_enabled: false minidlna_enabled: false jellyfin_enabled: false @@ -270,16 +262,6 @@ joomla_available_externally: "false" joomla_database_password: top_secret joomla_port: "8181" -### -### pyLoad -### -pyload_available_externally: "false" -pyload_config_directory: "{{ docker_home }}/pyload" -pyload_download_directory: "{{ downloads_root }}" -pyload_user_id: "0" -pyload_group_id: "0" -pyload_port: "8000" - ### ### PyTivo ### @@ -302,16 +284,6 @@ homebridge_user_id: "0" homebridge_group_id: "0" homebridge_port: "8087" - -### -### Tautulli -### -tautulli_available_externally: "false" -tautulli_config_directory: "{{ docker_home }}/tautulli/config" -tautulli_user_id: "0" -tautulli_group_id: "0" -tautulli_port: "8185" - ### ### Mylar ### @@ -443,13 +415,6 @@ minidlna_media_directory2: "{{ tv_root }}" minidlna_friendly_name: "{{ ansible_nas_hostname }}" minidlna_port: "8201" -### -### get_iplayer -### -get_iplayer_config_directory: "{{ docker_home }}/get_iplayer" -get_iplayer_download_directory: "{{ tv_root }}/iplayer_downloads" -get_iplayer_port: "8182" - ### ### mymediaforalexa ### @@ -479,16 +444,6 @@ firefly_available_externally: "false" firefly_data_directory: "{{ docker_home }}/firefly" firefly_port: "8066" -### -### Nzbget -### -nzbget_available_externally: "false" -nzbget_data_directory: "{{ docker_home }}/nzbget" -nzbget_download_directory: "{{ downloads_root }}" -nzbget_user_id: "0" -nzbget_group_id: "0" -nzbget_port: "6789" - ### ### Wallabag ### diff --git a/nas.yml b/nas.yml index ede7fed6..a6638c6d 100644 --- a/nas.yml +++ b/nas.yml @@ -118,6 +118,11 @@ - nextcloud when: (nextcloud_enabled | default(False)) + - role: nzbget + tags: + - nzbget + when: (nzbget_enabled | default(False)) + - role: organizr tags: - organizr @@ -128,6 +133,11 @@ - portainer when: (portainer_enabled | default(False)) + - role: pyload + tags: + - pyload + when: (pyload_enabled | default(False)) + - role: ombi tags: - ombi @@ -163,6 +173,11 @@ - syncthing when: (syncthing_enabled | default(False)) + - role: tautulli + tags: + - tautulli + when: (tautulli_enabled | default(False)) + - role: transmission tags: - transmission @@ -193,14 +208,6 @@ when: (firefly_enabled | default(False)) tags: firefly - - import_tasks: tasks/tautulli.yml - when: (tautulli_enabled | default(False)) - tags: tautulli - - - import_tasks: tasks/pyload.yml - when: (pyload_enabled | default(False)) - tags: pyload - - import_tasks: tasks/thelounge.yml when: (thelounge_enabled | default(False)) tags: thelounge @@ -241,10 +248,6 @@ when: (minidlna_enabled | default(False)) tags: minidlna - - import_tasks: tasks/get_iplayer.yml - when: (get_iplayer_enabled | default(False)) - tags: get_iplayer - - import_tasks: tasks/mymediaforalexa.yml when: (mymediaforalexa_enabled | default(False)) tags: mymediaforalexa @@ -257,10 +260,6 @@ when: (joomla_enabled | default(False)) tags: joomla - - import_tasks: tasks/nzbget.yml - when: (nzbget_enabled | default(False)) - tags: nzbget - - import_tasks: tasks/wallabag.yml when: (wallabag_enabled | default(False)) tags: wallabag diff --git a/roles/application-template/defaults/main.yml b/roles/application-template/defaults/main.yml new file mode 100644 index 00000000..cfe279f7 --- /dev/null +++ b/roles/application-template/defaults/main.yml @@ -0,0 +1,21 @@ +--- +# enable or disable the application +example_app_enabled: false +example_app_available_externally: "false" + +# directories +example_app_config_directory: "{{ docker_home }}/example_app/config" +example_app_logs: "{{ docker_home }}/example_app/logs" +example_app_share_directory: "{{ example_share_root }}" + + +# uid / gid +example_app_user_id: "0" +example_app_group_id: "0" + +# network +example_app_hostname: "example_app" +example_app_port: "12345" + +# specs +example_app_memory: "1g" diff --git a/roles/application-template/tasks/main.yml b/roles/application-template/tasks/main.yml new file mode 100644 index 00000000..73121a17 --- /dev/null +++ b/roles/application-template/tasks/main.yml @@ -0,0 +1,36 @@ +--- +- name: Create Example_App Directories + file: + path: "{{ item }}" + state: directory + # mode: 0755 + with_items: + - "{{ example_app_config_directory }}" + - "{{ example_app_logs }}" + +- name: example_app Docker Container + docker_container: + name: example_app + image: example_app/example_app + pull: true + volumes: + - "{{ example_app_config_directory }}:/config:rw" + - "{{ example_app_logs }}:/logs:rw" + - "{{ example_app_data_directory }}:/data:rw" + network_mode: "bridge" + ports: + - "{{ example_app_port_a }}:80" + - "{{ example_app_port_b }}:80" + env: + TZ: "{{ ansible_nas_timezone }}" + PUID: "{{ example_app_user_id }}" + PGID: "{{ example_app_group_id }}" + restart_policy: unless-stopped + memory: "{{ example_app_memory }}" + labels: + traefik.enable: "{{ example_app_available_externally }}" + traefik.http.routers.example_app.rule: "Host(`{{ example_app_hostname }}.{{ ansible_nas_domain }}`)" + traefik.http.routers.example_app.tls.certresolver: "letsencrypt" + traefik.http.routers.example_app.tls.domains[0].main: "{{ ansible_nas_domain }}" + traefik.http.routers.example_app.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" + traefik.http.services.example_app.loadbalancer.server.port: "80" diff --git a/roles/get-iplayer/defaults/main.yml b/roles/get-iplayer/defaults/main.yml new file mode 100644 index 00000000..c45a0124 --- /dev/null +++ b/roles/get-iplayer/defaults/main.yml @@ -0,0 +1,12 @@ +--- +get_iplayer_enabled: false + +# directories +get_iplayer_config_directory: "{{ docker_home }}/get_iplayer" +get_iplayer_download_directory: "{{ tv_root }}/iplayer_downloads" + +# network +get_iplayer_port: "8182" + +# specs +get_iplayer_memory: "1g" diff --git a/tasks/get_iplayer.yml b/roles/get-iplayer/tasks/main.yml similarity index 93% rename from tasks/get_iplayer.yml rename to roles/get-iplayer/tasks/main.yml index 2a25a4b0..e4e32bfb 100644 --- a/tasks/get_iplayer.yml +++ b/roles/get-iplayer/tasks/main.yml @@ -17,5 +17,5 @@ ports: - "{{ get_iplayer_port }}:8181" restart_policy: unless-stopped - memory: 1g + memory: "{{ get_iplayer_memory }}" diff --git a/roles/nzbget/defaults/main.yml b/roles/nzbget/defaults/main.yml new file mode 100644 index 00000000..4ba6dc2d --- /dev/null +++ b/roles/nzbget/defaults/main.yml @@ -0,0 +1,18 @@ +--- +nzbget_enabled: false +nzbget_available_externally: "false" + +# directories +nzbget_data_directory: "{{ docker_home }}/nzbget" +nzbget_download_directory: "{{ downloads_root }}" + +# uid / gid +nzbget_user_id: "0" +nzbget_group_id: "0" + +# network +nzbget_port: "6789" +nzbget_hostname: "nzbget" + +# specs +nzbget_app_memory: "1g" diff --git a/tasks/nzbget.yml b/roles/nzbget/tasks/main.yml similarity index 90% rename from tasks/nzbget.yml rename to roles/nzbget/tasks/main.yml index b66c5b68..bd27a9e1 100644 --- a/tasks/nzbget.yml +++ b/roles/nzbget/tasks/main.yml @@ -24,7 +24,7 @@ memory: 1g labels: traefik.enable: "{{ nzbget_available_externally }}" - traefik.http.routers.nzbget.rule: "Host(`nzbget.{{ ansible_nas_domain }}`)" + traefik.http.routers.nzbget.rule: "Host(`{{ nzbget_hostname }}.{{ ansible_nas_domain }}`)" traefik.http.routers.nzbget.tls.certresolver: "letsencrypt" traefik.http.routers.nzbget.tls.domains[0].main: "{{ ansible_nas_domain }}" traefik.http.routers.nzbget.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" diff --git a/roles/pyload/defaults/main.yml b/roles/pyload/defaults/main.yml new file mode 100644 index 00000000..2053c1f7 --- /dev/null +++ b/roles/pyload/defaults/main.yml @@ -0,0 +1,19 @@ +--- +pyload_enabled: false +pyload_available_externally: "false" + +# directories +pyload_config_directory: "{{ docker_home }}/pyload" +pyload_download_directory: "{{ downloads_root }}" + + +# uid / gid +pyload_user_id: "0" +pyload_group_id: "0" + +# network +pyload_hostname: "pyload" +pyload_port: "8000" + +# specs +pyload_memory: "1g" diff --git a/tasks/pyload.yml b/roles/pyload/tasks/main.yml similarity index 88% rename from tasks/pyload.yml rename to roles/pyload/tasks/main.yml index 3f783c3a..c758c954 100644 --- a/tasks/pyload.yml +++ b/roles/pyload/tasks/main.yml @@ -23,10 +23,10 @@ UID: "{{ pyload_user_id }}" GID: "{{ pyload_group_id }}" restart_policy: unless-stopped - memory: 1g + memory: "{{ pyload_memory }}" labels: traefik.enable: "{{ pyload_available_externally }}" - traefik.http.routers.pyload.rule: "Host(`pyload.{{ ansible_nas_domain }}`)" + traefik.http.routers.pyload.rule: "Host(`{{ pyload_hostname }}.{{ ansible_nas_domain }}`)" traefik.http.routers.pyload.tls.certresolver: "letsencrypt" traefik.http.routers.pyload.tls.domains[0].main: "{{ ansible_nas_domain }}" traefik.http.routers.pyload.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" diff --git a/roles/tautulli/defaults/main.yml b/roles/tautulli/defaults/main.yml new file mode 100644 index 00000000..95a0cc95 --- /dev/null +++ b/roles/tautulli/defaults/main.yml @@ -0,0 +1,17 @@ +--- +tautulli_enabled: false +tautulli_available_externally: "false" + +# directories +tautulli_config_directory: "{{ docker_home }}/tautulli/config" + +# uid / gid +tautulli_user_id: "0" +tautulli_group_id: "0" + +# network +tautulli_hostname: "tautulli" +tautulli_port: "8185" + +# specs +tautulli_memory: "1g" diff --git a/tasks/tautulli.yml b/roles/tautulli/tasks/main.yml similarity index 87% rename from tasks/tautulli.yml rename to roles/tautulli/tasks/main.yml index 277d4f65..2b481399 100644 --- a/tasks/tautulli.yml +++ b/roles/tautulli/tasks/main.yml @@ -22,10 +22,10 @@ PUID: "{{ tautulli_user_id }}" PGID: "{{ tautulli_group_id }}" restart_policy: unless-stopped - memory: 1g + memory: "{{ tautulli_memory }}" labels: traefik.enable: "{{ tautulli_available_externally }}" - traefik.http.routers.tautulli.rule: "Host(`tautulli.{{ ansible_nas_domain }}`)" + traefik.http.routers.tautulli.rule: "Host(`{{ tautulli_hostname }}.{{ ansible_nas_domain }}`)" traefik.http.routers.tautulli.tls.certresolver: "letsencrypt" traefik.http.routers.tautulli.tls.domains[0].main: "{{ ansible_nas_domain }}" traefik.http.routers.tautulli.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" From dda1f432ef7b85c66ebf79681f00e67729b78bb9 Mon Sep 17 00:00:00 2001 From: PurpleNinja225 Date: Fri, 29 Jan 2021 00:47:56 -0900 Subject: [PATCH 2/3] mv jackett to role --- group_vars/all.yml | 9 --------- nas.yml | 9 +++++---- roles/jackett/defaults/main.yml | 15 +++++++++++++++ tasks/jackett.yml => roles/jackett/tasks/main.yml | 2 +- 4 files changed, 21 insertions(+), 14 deletions(-) create mode 100644 roles/jackett/defaults/main.yml rename tasks/jackett.yml => roles/jackett/tasks/main.yml (89%) diff --git a/group_vars/all.yml b/group_vars/all.yml index 279a7a8a..e753528c 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml @@ -16,7 +16,6 @@ ### # Media Sourcing -jackett_enabled: false minidlna_enabled: false jellyfin_enabled: false @@ -421,14 +420,6 @@ minidlna_port: "8201" mymediaforalexa_media_directory: "{{ music_root }}" mymediaforalexa_data_directory: "{{ docker_home }}/mymediaforalexa" -### -### Jackett -### -jackett_available_externally: "false" -jackett_data_directory: "{{ docker_home }}/jackett" -jackett_torrents_root: "{{ torrents_root }}" -jackett_port: "9117" - ### ### The Lounge ### diff --git a/nas.yml b/nas.yml index a6638c6d..96726a5d 100644 --- a/nas.yml +++ b/nas.yml @@ -98,6 +98,11 @@ - homeassistant when: (homeassistant_enabled | default(False)) + - role: jackett + tags: + - jackett + when: (jackett_enabled | default(False)) + - role: lidarr tags: - lidarr @@ -252,10 +257,6 @@ when: (mymediaforalexa_enabled | default(False)) tags: mymediaforalexa - - import_tasks: tasks/jackett.yml - when: (jackett_enabled | default(False)) - tags: jackett - - import_tasks: tasks/joomla.yml when: (joomla_enabled | default(False)) tags: joomla diff --git a/roles/jackett/defaults/main.yml b/roles/jackett/defaults/main.yml new file mode 100644 index 00000000..6cfe892e --- /dev/null +++ b/roles/jackett/defaults/main.yml @@ -0,0 +1,15 @@ +--- +# enable or disable the application +jackett_enabled: false +jackett_available_externally: "false" + +# directories +jackett_data_directory: "{{ docker_home }}/jackett" +jackett_torrents_root: "{{ torrents_root }}" + +# network +jackett_hostname: "jackett" +jackett_port: "9117" + +# specs +jackett_memory: "1g" diff --git a/tasks/jackett.yml b/roles/jackett/tasks/main.yml similarity index 89% rename from tasks/jackett.yml rename to roles/jackett/tasks/main.yml index 18eed198..8aa82011 100644 --- a/tasks/jackett.yml +++ b/roles/jackett/tasks/main.yml @@ -21,7 +21,7 @@ restart_policy: unless-stopped labels: traefik.enable: "{{ jackett_available_externally }}" - traefik.http.routers.jackett.rule: "Host(`jackett.{{ ansible_nas_domain }}`)" + traefik.http.routers.jackett.rule: "Host(`{{ jackett_hostname }}.{{ ansible_nas_domain }}`)" traefik.http.routers.jackett.tls.certresolver: "letsencrypt" traefik.http.routers.jackett.tls.domains[0].main: "{{ ansible_nas_domain }}" traefik.http.routers.jackett.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" From cf0db6d8628c40a1b9ac420ba1d0fe77684209a0 Mon Sep 17 00:00:00 2001 From: PurpleNinja225 Date: Fri, 5 Feb 2021 15:18:35 -0900 Subject: [PATCH 3/3] fix review items --- nas.yml | 5 +++ roles/application-template/defaults/main.yml | 21 ----------- roles/application-template/tasks/main.yml | 36 ------------------- .../defaults/main.yml | 0 .../tasks/main.yml | 0 5 files changed, 5 insertions(+), 57 deletions(-) delete mode 100644 roles/application-template/defaults/main.yml delete mode 100644 roles/application-template/tasks/main.yml rename roles/{get-iplayer => get_iplayer}/defaults/main.yml (100%) rename roles/{get-iplayer => get_iplayer}/tasks/main.yml (100%) diff --git a/nas.yml b/nas.yml index 89b20996..6661430e 100644 --- a/nas.yml +++ b/nas.yml @@ -88,6 +88,11 @@ - gitea when: (gitea_enabled | default(False)) + - role: get_iplayer + tags: + - get_iplayer + when: (get_iplayer_enabled | default(False)) + - role: heimdall tags: - heimdall diff --git a/roles/application-template/defaults/main.yml b/roles/application-template/defaults/main.yml deleted file mode 100644 index cfe279f7..00000000 --- a/roles/application-template/defaults/main.yml +++ /dev/null @@ -1,21 +0,0 @@ ---- -# enable or disable the application -example_app_enabled: false -example_app_available_externally: "false" - -# directories -example_app_config_directory: "{{ docker_home }}/example_app/config" -example_app_logs: "{{ docker_home }}/example_app/logs" -example_app_share_directory: "{{ example_share_root }}" - - -# uid / gid -example_app_user_id: "0" -example_app_group_id: "0" - -# network -example_app_hostname: "example_app" -example_app_port: "12345" - -# specs -example_app_memory: "1g" diff --git a/roles/application-template/tasks/main.yml b/roles/application-template/tasks/main.yml deleted file mode 100644 index 73121a17..00000000 --- a/roles/application-template/tasks/main.yml +++ /dev/null @@ -1,36 +0,0 @@ ---- -- name: Create Example_App Directories - file: - path: "{{ item }}" - state: directory - # mode: 0755 - with_items: - - "{{ example_app_config_directory }}" - - "{{ example_app_logs }}" - -- name: example_app Docker Container - docker_container: - name: example_app - image: example_app/example_app - pull: true - volumes: - - "{{ example_app_config_directory }}:/config:rw" - - "{{ example_app_logs }}:/logs:rw" - - "{{ example_app_data_directory }}:/data:rw" - network_mode: "bridge" - ports: - - "{{ example_app_port_a }}:80" - - "{{ example_app_port_b }}:80" - env: - TZ: "{{ ansible_nas_timezone }}" - PUID: "{{ example_app_user_id }}" - PGID: "{{ example_app_group_id }}" - restart_policy: unless-stopped - memory: "{{ example_app_memory }}" - labels: - traefik.enable: "{{ example_app_available_externally }}" - traefik.http.routers.example_app.rule: "Host(`{{ example_app_hostname }}.{{ ansible_nas_domain }}`)" - traefik.http.routers.example_app.tls.certresolver: "letsencrypt" - traefik.http.routers.example_app.tls.domains[0].main: "{{ ansible_nas_domain }}" - traefik.http.routers.example_app.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" - traefik.http.services.example_app.loadbalancer.server.port: "80" diff --git a/roles/get-iplayer/defaults/main.yml b/roles/get_iplayer/defaults/main.yml similarity index 100% rename from roles/get-iplayer/defaults/main.yml rename to roles/get_iplayer/defaults/main.yml diff --git a/roles/get-iplayer/tasks/main.yml b/roles/get_iplayer/tasks/main.yml similarity index 100% rename from roles/get-iplayer/tasks/main.yml rename to roles/get_iplayer/tasks/main.yml