2019-05-06 20:55:40 +00:00
|
|
|
---
|
2023-03-10 15:40:33 +00:00
|
|
|
- name: Start pyLoad
|
|
|
|
block:
|
|
|
|
- name: Create pyLoad Directories
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: directory
|
|
|
|
# mode: 0755
|
|
|
|
with_items:
|
|
|
|
- "{{ pyload_config_directory }}"
|
|
|
|
- "{{ pyload_download_directory }}"
|
2019-05-06 20:55:40 +00:00
|
|
|
|
2023-03-10 15:40:33 +00:00
|
|
|
- name: Create pyLoad Docker Container
|
|
|
|
community.docker.docker_container:
|
|
|
|
name: "{{ pyload_container_name }}"
|
|
|
|
image: "{{ pyload_image_name }}:{{ pyload_image_version }}"
|
|
|
|
pull: true
|
|
|
|
volumes:
|
|
|
|
- "{{ pyload_config_directory }}:/opt/pyload/pyload-config:rw"
|
|
|
|
- "{{ pyload_download_directory }}:/opt/pyload/Downloads:rw"
|
|
|
|
ports:
|
|
|
|
- "{{ pyload_port }}:8000"
|
|
|
|
env:
|
|
|
|
TZ: "{{ ansible_nas_timezone }}"
|
|
|
|
UID: "{{ pyload_user_id }}"
|
|
|
|
GID: "{{ pyload_group_id }}"
|
|
|
|
restart_policy: unless-stopped
|
|
|
|
memory: "{{ pyload_memory }}"
|
|
|
|
labels:
|
|
|
|
traefik.enable: "{{ pyload_available_externally | string }}"
|
|
|
|
traefik.http.routers.pyload.rule: "Host(`{{ pyload_hostname }}.{{ ansible_nas_domain }}`)"
|
|
|
|
traefik.http.routers.pyload.tls.certresolver: "letsencrypt"
|
|
|
|
traefik.http.routers.pyload.tls.domains[0].main: "{{ ansible_nas_domain }}"
|
|
|
|
traefik.http.routers.pyload.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
|
|
|
|
traefik.http.services.pyload.loadbalancer.server.port: "8000"
|
|
|
|
when: pyload_enabled is true
|
|
|
|
|
|
|
|
- name: Stop pyLoad
|
|
|
|
block:
|
|
|
|
- name: Stop pyLoad
|
|
|
|
community.docker.docker_container:
|
|
|
|
name: "{{ pyload_container_name }}"
|
|
|
|
state: absent
|
|
|
|
when: pyload_enabled is false
|