homelab/roles/portainer/tasks/main.yml

30 lines
979 B
YAML
Raw Normal View History

2024-09-09 22:37:51 +10:00
---
- name: Create directories
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ data_folder }}/portainer"
- name: Create Portainer Container
docker_container:
name: portainer
image: portainer/portainer-ce:2.21.0
command: --admin-password "{{PORTAINER_ADMIN_PASSWORD}}"
restart_policy: unless-stopped
volumes:
- "{{ data_folder }}/portainer/data:/data"
- '/var/run/docker.sock:/var/run/docker.sock'
networks:
- name: proxy
labels:
traefik.enable: "true"
traefik.http.routers.portainer-secure.rule: "Host(`{{portainer_host}}`)"
traefik.http.routers.portainer-secure.entrypoints: "https"
traefik.http.routers.portainer-secure.tls: "true"
traefik.http.routers.portainer-secure.service: "portainer"
traefik.http.services.portainer.loadbalancer.server.port: "9443"
traefik.http.services.portainer.loadbalancer.server.scheme: "https"
register: container_portainer