# {{ ansible_managed }} networks: traefik: external: true services: traefik: image: traefik:v3 restart: always command: - "--log.level=INFO" - "--accesslog=true" - "--accesslog.fields.names.StartUTC=drop" - "--api=true" - "--api.dashboard=true" - "--providers.docker=true" - "--providers.docker.exposedbydefault=false" - "--providers.file.directory=/etc/traefik/dynamic" - "--entrypoints.web.address=:{{ docker_traefik_web_port }}" - "--entryPoints.web.forwardedHeaders.trustedIPs={{ docker_traefik_trusted_ips }}" - "--entrypoints.websecure.address=:{{ docker_traefik_websecure_port }}" - "--entryPoints.websecure.forwardedHeaders.trustedIPs={{ docker_traefik_trusted_ips }}" - "--entrypoints.api.address=:{{ docker_traefik_admin_port }}" - "--entrypoints.nodeexporter.address=:{{ docker_traefik_nodeexporter_port }}" - "--entrypoints.cadvisor.address=:{{ docker_traefik_cadvisor_port }}" labels: - "traefik.enable=true" - "traefik.docker.network=traefik" - "traefik.port={{ docker_traefik_admin_port }}" - "traefik.http.routers.api.entrypoints=api" - "traefik.http.routers.api.rule=(PathPrefix(`/api`) || PathPrefix(`/dashboard`))" - "traefik.http.routers.api.service=api@internal" - "traefik.http.routers.api.middlewares=auth" - "traefik.http.routers.api.tls" - "traefik.http.middlewares.auth.basicauth.users={{ docker_traefik_admin }}" ports: - "{{ docker_traefik_listen_ip }}:{{ docker_traefik_web_port }}:{{ docker_traefik_web_port }}" - "{{ docker_traefik_listen_ip }}:{{ docker_traefik_websecure_port }}:{{ docker_traefik_websecure_port }}" - "{{ docker_traefik_listen_ip }}:{{ docker_traefik_nodeexporter_port }}:{{ docker_traefik_nodeexporter_port }}" - "{{ docker_traefik_listen_ip }}:{{ docker_traefik_cadvisor_port }}:{{ docker_traefik_cadvisor_port }}" - "{{ docker_traefik_admin_listen_ip }}:{{ docker_traefik_admin_port }}:{{ docker_traefik_admin_port }}" volumes: - /var/run/docker.sock:/var/run/docker.sock:ro - ./certs-traefik.yaml:/etc/traefik/dynamic/certs-traefik.yaml - ./key.pem:/etc/certs/key.pem - ./cert.pem:/etc/certs/cert.pem environment: - TZ=Europe/Paris networks: - traefik userns_mode: "host"