ansible-nas/roles/jackett/tasks/main.yml
2024-02-26 16:23:00 +00:00

45 lines
1.8 KiB
YAML

---
- name: Start Jackett
block:
- name: Create Jackett Directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
with_items:
- "{{ jackett_data_directory }}"
- name: Jackett Docker Container
community.docker.docker_container:
name: "{{ jackett_container_name }}"
image: "{{ jackett_image_name }}:{{ jackett_image_version }}"
volumes:
- "{{ jackett_data_directory }}:/config:rw"
- "/etc/localtime:/etc/localtime:ro"
- "{{ jackett_torrents_root }}:/downloads"
ports:
- "{{ jackett_port }}:9117"
env:
TZ: "{{ ansible_nas_timezone }}"
restart_policy: unless-stopped
memory: "{{ jackett_memory }}"
labels:
traefik.enable: "{{ jackett_available_externally | string }}"
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 }}"
traefik.http.services.jackett.loadbalancer.server.port: "9117"
homepage.group: Download Tools
homepage.name: Jackett
homepage.icon: jackett
homepage.href: http://{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}:{{ jackett_port }}
homepage.description: API Support for your favorite torrent trackers
when: jackett_enabled is true
- name: Stop Jackett
block:
- name: Stop Jackett
community.docker.docker_container:
name: "{{ jackett_container_name }}"
state: absent
when: jackett_enabled is false