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

43 lines
1.5 KiB
YAML
Raw Normal View History

2019-06-02 20:15:34 +00:00
---
2023-03-09 20:47:42 +00:00
- name: Start NZBget
block:
- name: Create NZBget Directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
with_items:
- "{{ nzbget_data_directory }}"
2019-06-02 20:15:34 +00:00
2023-03-09 20:47:42 +00:00
- name: NZBGet
community.docker.docker_container:
name: "{{ nzbget_container_name }}"
image: "{{ nzbget_image_name }}:{{ nzbget_image_version }}"
pull: true
volumes:
- "{{ nzbget_download_directory }}:/downloads:rw"
- "{{ nzbget_data_directory }}:/config:rw"
ports:
- "{{ nzbget_port }}:6789"
env:
TZ: "{{ ansible_nas_timezone }}"
PUID: "{{ nzbget_user_id }}"
PGID: "{{ nzbget_group_id }}"
restart_policy: unless-stopped
memory: "{{ nzbget_memory }}"
labels:
traefik.enable: "{{ nzbget_available_externally | string }}"
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 }}"
traefik.http.services.nzbget.loadbalancer.server.port: "6789"
when: nzbget_enabled is true
- name: Stop NZBget
block:
- name: Stop NZBget
community.docker.docker_container:
name: "{{ nzbget_container_name }}"
state: absent
when: nzbget_enabled is false