ansible-nas/roles/lidarr/tasks/main.yml
2023-03-09 21:47:42 +01:00

42 lines
1.6 KiB
YAML

---
- name: Start Lidarr
block:
- name: Create Lidarr Directory
ansible.builtin.file:
path: "{{ lidarr_data_directory }}"
state: directory
- name: Lidarr Docker Container
community.docker.docker_container:
container_default_behavior: no_defaults
name: "{{ lidarr_container_name }}"
image: "{{ lidarr_image_name }}:{{ lidarr_image_version }}"
pull: true
volumes:
- "{{ lidarr_music_directory }}:/music:rw"
- "{{ lidarr_downloads_directory }}:/downloads:rw"
- "{{ lidarr_data_directory }}:/config:rw"
ports:
- "{{ lidarr_port }}:8686"
env:
TZ: "{{ ansible_nas_timezone }}"
PUID: "{{ lidarr_user_id }}"
PGID: "{{ lidarr_group_id }}"
restart_policy: unless-stopped
memory: "{{ lidarr_memory }}"
labels:
traefik.enable: "{{ lidarr_available_externally | string }}"
traefik.http.routers.lidarr.rule: "Host(`{{ lidarr_hostname }}.{{ ansible_nas_domain }}`)"
traefik.http.routers.lidarr.tls.certresolver: "letsencrypt"
traefik.http.routers.lidarr.tls.domains[0].main: "{{ ansible_nas_domain }}"
traefik.http.routers.lidarr.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.services.lidarr.loadbalancer.server.port: "8686"
when: lidarr_enabled is true
- name: Stop Lidarr
block:
- name: Stop Lidarr
community.docker.docker_container:
name: "{{ lidarr_container_name }}"
state: absent
when: lidarr_enabled is false