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

48 lines
1.7 KiB
YAML
Raw Normal View History

2021-12-27 23:50:05 +00:00
---
2023-03-09 20:47:42 +00:00
- name: Start Komga
block:
- name: Create Komga Directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
# mode: 0755
with_items:
- "{{ komga_data_directory }}"
- "{{ komga_data_directory }}/config"
2021-12-27 23:50:05 +00:00
2023-03-09 20:47:42 +00:00
- name: Komga Docker Container
community.docker.docker_container:
name: "{{ komga_container_name }}"
image: "{{ komga_image_name }}:{{ komga_image_version }}"
pull: true
volumes:
- "{{ komga_comics_directory }}:/comics:ro"
- "{{ komga_books_directory }}:/books:ro"
- "{{ komga_data_directory }}:/data:rw"
- "{{ komga_data_directory }}/config:/config:rw"
network_mode: "bridge"
ports:
- "{{ komga_port_http }}:8080"
env:
TZ: "{{ ansible_nas_timezone }}"
PUID: "{{ komga_user_id }}"
PGID: "{{ komga_group_id }}"
restart_policy: unless-stopped
memory: "{{ komga_memory }}"
labels:
traefik.enable: "{{ komga_available_externally | string }}"
traefik.http.routers.komga.rule: "Host(`{{ komga_hostname }}.{{ ansible_nas_domain }}`)"
traefik.http.routers.komga.tls.certresolver: "letsencrypt"
traefik.http.routers.komga.tls.domains[0].main: "{{ ansible_nas_domain }}"
traefik.http.routers.komga.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.services.komga.loadbalancer.server.port: "8080"
when: komga_enabled is true
- name: Stop Komga
block:
- name: Stop Komga
community.docker.docker_container:
name: "{{ komga_container_name }}"
state: absent
when: komga_enabled is false