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

48 lines
1.8 KiB
YAML

---
- name: Start Krusader
block:
- name: Krusader Directory
ansible.builtin.file:
path: "{{ item }}"
state: directory
with_items:
- "{{ krusader_config_directory }}/krusader"
- name: Krusader Docker Container
community.docker.docker_container:
container_default_behavior: no_defaults
name: "{{ krusader_container_name }}"
image: "{{ krusader_image_name }}:{{ krusader_image_version }}"
pull: true
privileged: true
volumes:
- "{{ krusader_config_directory }}:/config:rw"
- "{{ krusader_browse_directory }}:/mnt/fs"
ports:
- "{{ krusader_port_http }}:6080"
- "{{ krusader_port_vnc }}:5900"
env:
PUID: "{{ krusader_user_id }}"
PGID: "{{ krusader_group_id }}"
VNC_PASSWORD: "{{ krusader_vnc_password }}"
TEMP_FOLDER: "{{ krusader_temp_folder }}"
WEBPAGE_TITLE: "{{ krusader_webpage_title }}"
UMASK: "{{ krusader_umask }}"
restart_policy: unless-stopped
memory: "{{ krusader_memory }}"
labels:
traefik.enable: "{{ krusader_available_externally }}"
traefik.http.routers.krusader.rule: "Host(`{{ krusader_hostname }}.{{ ansible_nas_domain }}`)"
traefik.http.routers.krusader.tls.certresolver: "letsencrypt"
traefik.http.routers.krusader.tls.domains[0].main: "{{ ansible_nas_domain }}"
traefik.http.routers.krusader.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.services.krusader.loadbalancer.server.port: "6080"
when: krusader_enabled is true
- name: Stop Krusader
block:
- name: Stop Krusader
community.docker.docker_container:
name: "{{ krusader_container_name }}"
state: absent
when: krusader_enabled is false