This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
# {{ ansible_managed }}
|
||||
[Unit]
|
||||
Description=Traefik
|
||||
Wants=docker.service
|
||||
After=docker.service
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
ExecStart=/usr/local/bin/docker-compose -f "{{ traefik_docker_compose_directory }}/docker-compose.yml" up
|
||||
ExecStop=/usr/local/bin/docker-compose -f "{{ traefik_docker_compose_directory }}/docker-compose.yml" down
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
27
roles/traefik/templates/opt/traefik/docker-compose.yml.j2
Normal file
27
roles/traefik/templates/opt/traefik/docker-compose.yml.j2
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
# {{ ansible_managed }}
|
||||
version: '3.2'
|
||||
services:
|
||||
traefik:
|
||||
image: traefik:{{ traefik_version }}
|
||||
restart: always
|
||||
command: --api --docker # Enables the web UI and tells Traefik to listen to docker
|
||||
ports:
|
||||
- "80:80" # The HTTP port
|
||||
- "443:443" # The HTTPS ports
|
||||
{% if traefik_dashboard_enabled %}
|
||||
- "8080:8080" # Dashboard port
|
||||
{% endif %}
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock # So that Traefik can listen to the Docker events
|
||||
- {{ traefik_docker_compose_directory }}/traefik.toml:/traefik.toml
|
||||
- {{ traefik_docker_compose_directory }}/acme.json:/acme.json
|
||||
labels:
|
||||
- traefik.enable=true
|
||||
- traefik.docker.network=traefik_network
|
||||
networks:
|
||||
- traefik_network
|
||||
|
||||
networks:
|
||||
traefik_network:
|
||||
external: true
|
||||
43
roles/traefik/templates/opt/traefik/traefik.toml.j2
Executable file
43
roles/traefik/templates/opt/traefik/traefik.toml.j2
Executable file
@@ -0,0 +1,43 @@
|
||||
# {{ ansible_managed }}
|
||||
###Traefik.toml###
|
||||
|
||||
logLevel = "{{ traefik_docker_log_level }}"
|
||||
defaultEntryPoints = ["http","https"]
|
||||
|
||||
[entryPoints]
|
||||
[entryPoints.http]
|
||||
address = ":80"
|
||||
[entryPoints.http.redirect]
|
||||
entryPoint = "https"
|
||||
[entryPoints.https]
|
||||
address = ":443"
|
||||
[entryPoints.https.tls]
|
||||
{% if not traefik_acme_enabled %}
|
||||
[[entryPoints.https.tls.certificate]]
|
||||
certFile = "/certs/local-cert.pem"
|
||||
keyFile = "/certs/local-key.pem"
|
||||
{% endif %}
|
||||
|
||||
{% if traefik_dashboard_enabled %}
|
||||
[api]
|
||||
# With this you enable the web UI
|
||||
insecure = true
|
||||
dashboard = true
|
||||
{% endif %}
|
||||
|
||||
{% if traefik_acme_enabled %}
|
||||
[acme]
|
||||
email = "etienne.besson@gmail.com"
|
||||
storage = "acme.json"
|
||||
onHostRule = true
|
||||
entryPoint = "https"
|
||||
[acme.tlsChallenge]
|
||||
{% endif %}
|
||||
|
||||
# Enable Docker configuration backend
|
||||
[docker]
|
||||
endpoint = "unix:///var/run/docker.sock"
|
||||
domain = "{{ traefik_docker_domain }}"
|
||||
watch = true
|
||||
exposedByDefault = false
|
||||
|
||||
Reference in New Issue
Block a user