From 002e97e07b3bcefd1023658c61ecf26c5fd6747e Mon Sep 17 00:00:00 2001 From: PurpleNinja225 Date: Fri, 5 Feb 2021 14:58:38 -0900 Subject: [PATCH] move pytivo to roles --- group_vars/all.yml | 17 ----------------- nas.yml | 11 ++++++----- roles/pytivo/defaults/main.yml | 18 ++++++++++++++++++ .../pytivo.yml => roles/pytivo/tasks/main.yml | 15 +++++++-------- 4 files changed, 31 insertions(+), 30 deletions(-) create mode 100644 roles/pytivo/defaults/main.yml rename tasks/pytivo.yml => roles/pytivo/tasks/main.yml (85%) diff --git a/group_vars/all.yml b/group_vars/all.yml index ea422fcb..6e816cc9 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml @@ -74,10 +74,6 @@ ubooquity_enabled: false # Joomla joomla_enabled: false -# PyTivo -pytivo_enabled: false - - ### ### General ### @@ -278,19 +274,6 @@ pyload_user_id: "0" pyload_group_id: "0" pyload_port: "8000" -### -### PyTivo -### -pytivo_available_externally: "false" -pytivo_config_directory: "{{ docker_home }}/pytivo/config" -pytivo_movies_directory: "{{ movies_root }}" -pytivo_tv_directory: "{{ tv_root }}" -pytivo_photos_directory: "{{ photos_root }}" -pytivo_music_directory: "{{ music_root }}" -pytivo_podcasts_directory: "{{ podcasts_root }}" -pytivo_user_id: "0" -pytivo_group_id: "0" - ### ### Homebridge ### diff --git a/nas.yml b/nas.yml index b3d30af3..3d2b1f2b 100644 --- a/nas.yml +++ b/nas.yml @@ -148,6 +148,11 @@ - plex when: (plex_enabled | default(False)) + - role: pytivo + tags: + - pytivo + when: (pytivo_enabled | default(False)) + - role: radarr tags: - radarr @@ -305,8 +310,4 @@ - import_tasks: tasks/virtual_desktop.yml when: (virtual_desktop_enabled | default(False)) - tags: virtual_desktop - - - import_tasks: tasks/pytivo.yml - when: (pytivo_enabled | default(False)) - tags: pytivo + tags: virtual_desktop \ No newline at end of file diff --git a/roles/pytivo/defaults/main.yml b/roles/pytivo/defaults/main.yml new file mode 100644 index 00000000..d9075181 --- /dev/null +++ b/roles/pytivo/defaults/main.yml @@ -0,0 +1,18 @@ +--- +pytivo_enabled: false +pytivo_available_externally: "false" + +# directories +pytivo_config_directory: "{{ docker_home }}/pytivo/config" +pytivo_movies_directory: "{{ movies_root }}" +pytivo_tv_directory: "{{ tv_root }}" +pytivo_photos_directory: "{{ photos_root }}" +pytivo_music_directory: "{{ music_root }}" +pytivo_podcasts_directory: "{{ podcasts_root }}" + +# uid / gid +pytivo_user_id: "0" +pytivo_group_id: "0" + +# network +pytivo_hostname: "pytivo" \ No newline at end of file diff --git a/tasks/pytivo.yml b/roles/pytivo/tasks/main.yml similarity index 85% rename from tasks/pytivo.yml rename to roles/pytivo/tasks/main.yml index fe50b24b..882e27e2 100644 --- a/tasks/pytivo.yml +++ b/roles/pytivo/tasks/main.yml @@ -1,5 +1,5 @@ --- -- name: PyTivo - create config directory +- name: Create Pytivo Directories file: path: "{{ item }}" state: directory @@ -7,14 +7,11 @@ with_items: - "{{ pytivo_config_directory }}" -- name: PyTivo - install Docker container +- name: Pytivo docker_container: name: pytivo image: pinion/docker-pytivo pull: true - ports: - - "9032:9032" - - "2190:2190/udp" volumes: - "/etc/localtime:/etc/localtime:ro" - "{{ pytivo_config_directory }}:/config:rw" @@ -23,7 +20,9 @@ - "{{ pytivo_photos_directory }}:/photos:ro" - "{{ pytivo_music_directory }}:/music:ro" - "{{ pytivo_podcasts_directory }}:/podcasts:ro" - network_mode: "host" + ports: + - "9032:9032" + - "2190:2190/udp" env: TZ: "{{ ansible_nas_timezone }}" PUID: "{{ pytivo_user_id }}" @@ -32,8 +31,8 @@ memory: 1g labels: traefik.enable: "{{ pytivo_available_externally }}" - traefik.http.routers.pytivo.rule: "Host(`pytivo.{{ ansible_nas_domain }}`)" + traefik.http.routers.pytivo.rule: "Host(`{{ pytivo_hostname }}.{{ ansible_nas_domain }}`)" traefik.http.routers.pytivo.tls.certresolver: "letsencrypt" traefik.http.routers.pytivo.tls.domains[0].main: "{{ ansible_nas_domain }}" traefik.http.routers.pytivo.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" - traefik.http.services.pytivo.loadbalancer.server.port: "9032" + traefik.http.services.pytivo.loadbalancer.server.port: "9032" \ No newline at end of file