ansible-nas/roles/deluge/tasks/main.yml
2023-11-03 16:24:03 +01:00

43 lines
1.5 KiB
YAML

---
- name: Start Deluge
block:
- name: Create Deluge Directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
with_items:
- "{{ deluge_config_directory }}"
- "{{ deluge_download_directory }}"
- name: Deluge Docker Container
community.docker.docker_container:
name: deluge
image: linuxserver/deluge
pull: true
volumes:
- "{{ deluge_config_directory }}:/config:rw"
- "{{ deluge_download_directory }}:/downloads:rw"
ports:
- "{{ deluge_port }}:8112"
env:
TZ: "{{ deluge_timezone }}"
PUID: "{{ deluge_user_id }}"
PGID: "{{ deluge_group_id }}"
restart_policy: unless-stopped
memory: "{{ deluge_memory }}"
labels:
traefik.enable: "{{ deluge_available_externally | string }}"
traefik.http.routers.deluge.rule: "Host(`{{ deluge_hostname }}.{{ ansible_nas_domain }}`)"
traefik.http.routers.deluge.tls.certresolver: "letsencrypt"
traefik.http.routers.deluge.tls.domains[0].main: "{{ ansible_nas_domain }}"
traefik.http.routers.deluge.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.services.deluge.loadbalancer.server.port: "8112"
when: deluge_enabled is true
- name: Stop Deluge
block:
- name: Stop Deluge
community.docker.docker_container:
name: "{{ deluge_container_name }}"
state: absent
when: deluge_enabled is false