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

43 lines
1.5 KiB
YAML
Raw Normal View History

2021-08-21 00:24:45 +00:00
---
- name: Start Prowlarr
block:
- name: Create Prowlarr Directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
with_items:
- "{{ prowlarr_data_directory }}"
2021-08-21 00:24:45 +00:00
- name: Create Prowlarr Docker Container
community.docker.docker_container:
container_default_behavior: no_defaults
name: "{{ prowlarr_container_name }}"
image: "{{ prowlarr_image_name }}:{{ prowlarr_image_version }}"
pull: true
volumes:
- "{{ prowlarr_data_directory }}:/config:rw"
ports:
- "{{ prowlarr_port }}:9696"
env:
TZ: "{{ ansible_nas_timezone }}"
PUID: "{{ prowlarr_user_id }}"
PGID: "{{ prowlarr_group_id }}"
restart_policy: unless-stopped
memory: "{{ prowlarr_memory }}"
labels:
traefik.enable: "{{ prowlarr_available_externally | string }}"
traefik.http.routers.prowlarr.rule: "Host(`{{ prowlarr_hostname }}.{{ ansible_nas_domain }}`)"
traefik.http.routers.prowlarr.tls.certresolver: "letsencrypt"
traefik.http.routers.prowlarr.tls.domains[0].main: "{{ ansible_nas_domain }}"
traefik.http.routers.prowlarr.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.services.prowlarr.loadbalancer.server.port: "9696"
when: prowlarr_enabled is true
- name: Stop Prowlarr
block:
- name: Stop Prowlarr
community.docker.docker_container:
name: "{{ prowlarr_container_name }}"
state: absent
when: prowlarr_enabled is false