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

53 lines
2.3 KiB
YAML
Raw Normal View History

2020-04-23 06:12:39 +00:00
---
2023-03-10 21:00:37 +00:00
- name: Start Youtubedlmaterial
block:
- name: Create Youtubedlmaterial Directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
# mode: 0755
with_items:
- "{{ youtubedlmaterial_data_directory }}/appdata"
- "{{ youtubedlmaterial_data_directory }}/audio"
- "{{ youtubedlmaterial_data_directory }}/video"
- "{{ youtubedlmaterial_data_directory }}/subscriptions"
- "{{ youtubedlmaterial_dl_audio_directory }}"
- "{{ youtubedlmaterial_dl_video_directory }}"
- "{{ youtubedlmaterial_dl_subscriptions_directory }}"
2020-04-23 06:12:39 +00:00
2023-03-10 21:00:37 +00:00
- name: Create Youtubedlmaterial Docker Container
community.docker.docker_container:
container_default_behavior: no_defaults
name: "{{ youtubedlmaterial_container_name }}"
image: "{{ youtubedlmaterial_image_name }}:{{ youtubedlmaterial_image_version }}"
pull: true
volumes:
- "{{ youtubedlmaterial_data_directory }}/appdata:/app/appdata:rw"
- "{{ youtubedlmaterial_dl_audio_directory }}:/app/audio:rw"
- "{{ youtubedlmaterial_dl_video_directory }}:/app/video:rw"
- "{{ youtubedlmaterial_dl_subscriptions_directory }}:/app/subscriptions:rw"
network_mode: "bridge"
ports:
- "{{ youtubedlmaterial_port_http }}:17442"
env:
ALLOW_CONFIG_MUTATIONS: "true"
TZ: "{{ ansible_nas_timezone }}"
restart_policy: unless-stopped
memory: "{{ youtubedlmaterial_memory }}"
labels:
traefik.enable: "{{ youtubedlmaterial_available_externally | string }}"
traefik.http.routers.youtubedlmaterial.rule: "Host(`{{ youtubedlmaterial_hostname }}.{{ ansible_nas_domain }}`)"
traefik.http.routers.youtubedlmaterial.tls.certresolver: "letsencrypt"
traefik.http.routers.youtubedlmaterial.tls.domains[0].main: "{{ ansible_nas_domain }}"
traefik.http.routers.youtubedlmaterial.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.services.youtubedlmaterial.loadbalancer.server.port: "17442"
when: youtubedlmaterial_enabled is true
- name: Stop Youtubedlmaterial
block:
- name: Stop Youtubedlmaterial
community.docker.docker_container:
name: "{{ youtubedlmaterial_container_name }}"
state: absent
when: youtubedlmaterial_enabled is false