Refactor Traefik deploy: docker-compose + systemd

- Replace docker_container ansible with new setup
- Add option to disable HTTPS for alternate reverse proxy use
This commit is contained in:
2023-04-21 03:04:53 -04:00
parent c67a39982e
commit 9512212b84
8 changed files with 75 additions and 49 deletions

View File

@@ -0,0 +1,8 @@
# {{ ansible_managed }}
traefik_version={{ traefik_version }}
traefik_name={{ traefik_name }}
traefik_domain={{ traefik_domain }}
traefik_dashboard={{ traefik_dashboard | string | lower }}
traefik_debug={{ traefik_debug | string | lower }}
traefik_web_entry={{ traefik_web_entry }}
traefik_websecure_entry={{ traefik_websecure_entry }}

View File

@@ -0,0 +1,25 @@
version: '3.7'
networks:
traefik:
name: traefik
services:
traefik:
image: "traefik:${traefik_version}"
container_name: "${traefik_name}"
ports:
- "${traefik_web_entry:-80:80}"
{% if traefik_standalone and not traefik_http_only %}
- "${traefik_websecure_entry:-443:443}"
{% endif %}
networks:
- traefik
labels:
- "traefik.http.routers.traefik.rule=Host(`{{ traefik_domain }}`)"
- "traefik.http.routers.traefik.service=api@internal"
- "traefik.docker.network=traefik"
- "traefik.enable=${traefik_dashboard:-false}"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- "{{ traefik_root }}/config:/etc/traefik"

View File

@@ -10,7 +10,7 @@ providers:
entrypoints:
web:
address: ':80'
{% if traefik_http_redirect is defined and traefik_http_redirect %}
{% if traefik_http_redirect is defined and traefik_http_redirect and not traefik_http_only %}
http:
redirections:
entrypoint:
@@ -18,10 +18,12 @@ entrypoints:
scheme: https
permanent: true
{% endif %}
{% if not traefik_http_only is defined or not traefik_http_only %}
websecure:
address: ':443'
http:
tls: {}
{% endif %}
{% if traefik_acme_email is defined %}
certificatesResolvers: