ansible-nas/roles/heimdall/tasks/main.yml
2024-02-25 15:29:54 +00:00

41 lines
1.4 KiB
YAML

---
- name: Start Heimdall
block:
- name: Create Heimdall Directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: heimdall
group: heimdall
with_items:
- "{{ heimdall_data_directory }}"
- name: Create Heimdall container
community.docker.docker_container:
name: "{{ heimdall_container_name }}"
image: "{{ heimdall_docker_image }}"
pull: true
volumes:
- "{{ heimdall_data_directory }}:/config:rw"
env:
TZ: "{{ ansible_nas_timezone }}"
ports:
- "{{ heimdall_port_http }}:80"
restart_policy: unless-stopped
memory: "{{ heimdall_memory }}"
labels:
traefik.enable: "{{ heimdall_available_externally | string }}"
traefik.http.routers.heimdall.rule: "Host(`{{ heimdall_hostname }}.{{ ansible_nas_domain }}`)"
traefik.http.routers.heimdall.tls.certresolver: "letsencrypt"
traefik.http.routers.heimdall.tls.domains[0].main: "{{ ansible_nas_domain }}"
traefik.http.routers.heimdall.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.services.heimdall.loadbalancer.server.port: "80"
when: heimdall_enabled is true
- name: Stop Heimdall
block:
- name: Stop Heimdall
community.docker.docker_container:
name: "{{ heimdall_container_name }}"
state: absent
when: heimdall_enabled is false