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:
8
roles/traefik/templates/compose-env.j2
Normal file
8
roles/traefik/templates/compose-env.j2
Normal 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 }}
|
25
roles/traefik/templates/docker-compose.yml.j2
Normal file
25
roles/traefik/templates/docker-compose.yml.j2
Normal 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"
|
@@ -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:
|
||||
|
Reference in New Issue
Block a user