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

33 lines
1.2 KiB
YAML

---
- name: Create Octoprint Directories
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ octoprint_data_directory }}"
- name: Octoprint Docker Container
docker_container:
name: octoprint
image: octoprint/octoprint
pull: true
volumes:
- "{{ octoprint_data_directory }}:/octoprint:rw"
ports:
- "{{ octoprint_port }}:80"
devices:
- "{{ octoprint_printer_mountpoint }}"
- "{{ octoprint_enable_webcam | ternary(octoprint_webcam_mountpoint, '/dev/null') }}"
restart_policy: unless-stopped
memory: "{{ octoprint_memory }}"
env:
TZ: "{{ ansible_nas_timezone }}"
MJPG_STREAMER_INPUT: "-n -r 1080x1024 -f 30"
ENABLE_MJPG_STREAMER: "{{ octoprint_enable_webcam | string }}"
labels:
traefik.enable: "{{ octoprint_available_externally | string }}"
traefik.http.routers.octoprint.rule: "Host(`{{ octoprint_hostname }}.{{ ansible_nas_domain }}`)"
traefik.http.routers.octoprint.tls.certresolver: "letsencrypt"
traefik.http.routers.octoprint.tls.domains[0].main: "{{ ansible_nas_domain }}"
traefik.http.routers.octoprint.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.services.octoprint.loadbalancer.server.port: "80"