ansible-nas/roles/portainer/tasks/main.yml
2021-02-23 15:16:29 +00:00

28 lines
1 KiB
YAML

---
- name: Create Portainer Directories
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ portainer_data_directory }}"
- name: Portainer Docker Container
docker_container:
name: portainer
image: portainer/portainer-ce
pull: true
volumes:
- "{{ portainer_data_directory }}:/data:rw"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "/etc/timezone:/etc/timezone:ro"
ports:
- "{{ portainer_port }}:9000"
restart_policy: unless-stopped
memory: "{{ portainer_memory }}"
labels:
traefik.enable: "{{ portainer_available_externally }}"
traefik.http.routers.portainer.rule: "Host(`{{ portainer_hostname }}.{{ ansible_nas_domain }}`)"
traefik.http.routers.portainer.tls.certresolver: "letsencrypt"
traefik.http.routers.portainer.tls.domains[0].main: "{{ ansible_nas_domain }}"
traefik.http.routers.portainer.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.services.portainer.loadbalancer.server.port: "9000"