ansible-nas/roles/sabnzbd/tasks/main.yml

43 lines
1.5 KiB
YAML
Raw Normal View History

2020-01-30 14:47:37 +00:00
---
- name: Start Sabnzbd
block:
- name: Create Sabnzbd Data Directory
ansible.builtin.file:
path: "{{ item }}"
state: directory
with_items:
- "{{ sabnzbd_data_directory }}"
2020-01-30 14:47:37 +00:00
- name: Sabnzbd
community.docker.docker_container:
name: "{{ sabnzbd_container_name }}"
image: "{{ sabnzbd_image_name }}:{{ sabnzbd_image_version }}"
pull: true
volumes:
- "{{ sabnzbd_data_directory }}:/config:rw"
- "{{ sabnzbd_downloads_directory }}:/downloads"
- "{{ sabnzbd_incomplete_directory }}:/incomplete-downloads"
ports:
- "{{ sabnzbd_port }}:8080"
env:
TZ: "{{ ansible_nas_timezone }}"
PUID: "{{ sabnzbd_user_id }}"
PGID: "{{ sabnzbd_group_id }}"
restart_policy: unless-stopped
labels:
traefik.enable: "{{ sabnzbd_available_externally | string }}"
traefik.http.routers.sabnzbd.rule: "Host(`{{ sabnzbd_hostname }}.{{ ansible_nas_domain }}`)"
traefik.http.routers.sabnzbd.tls.certresolver: "letsencrypt"
traefik.http.routers.sabnzbd.tls.domains[0].main: "{{ ansible_nas_domain }}"
traefik.http.routers.sabnzbd.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.services.sabnzbd.loadbalancer.server.port: "8080"
when: sabnzbd_enabled is true
- name: Stop Sabnzbd
block:
- name: Stop Sabnzbd
community.docker.docker_container:
name: "{{ sabnzbd_container_name }}"
state: absent
when: sabnzbd_enabled is false