ansible-nas/roles/emby/tasks/main.yml
2024-02-25 15:21:15 +00:00

45 lines
1.6 KiB
YAML

---
- name: Start Emby
block:
- name: Create Emby Directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
with_items:
- "{{ emby_config_directory }}"
- name: Emby Docker Container
community.docker.docker_container:
name: "{{ emby_container_name }}"
image: "{{ emby_image }}:{{ emby_image_tag }}"
pull: true
volumes:
- "{{ emby_config_directory }}:/config:rw"
- "{{ emby_movies_directory }}:/movies:{{ emby_movies_permissions }}"
- "{{ emby_tv_directory }}:/tv:{{ emby_tv_permissions }}"
ports:
- "{{ emby_port_http }}:8096"
- "{{ emby_port_https }}:8920"
devices: "{{ emby_devices | default(omit) }}"
env:
TZ: "{{ ansible_nas_timezone }}"
PUID: "{{ emby_user_id }}"
PGID: "{{ emby_group_id }}"
restart_policy: unless-stopped
memory: "{{ emby_memory }}"
labels:
traefik.enable: "{{ emby_available_externally | string }}"
traefik.http.routers.emby.rule: "Host(`{{ emby_hostname }}.{{ ansible_nas_domain }}`)"
traefik.http.routers.emby.tls.certresolver: "letsencrypt"
traefik.http.routers.emby.tls.domains[0].main: "{{ ansible_nas_domain }}"
traefik.http.routers.emby.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.services.emby.loadbalancer.server.port: "8096"
when: emby_enabled is true
- name: Stop Emby
block:
- name: Stop Emby
community.docker.docker_container:
name: "{{ emby_container_name }}"
state: absent
when: emby_enabled is false