You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
1.9 KiB
77 lines
1.9 KiB
5 years ago
|
# https://docs.traefik.io/user-guide/docker-and-lets-encrypt/
|
||
|
|
||
|
- hosts: attitude-adjuster
|
||
|
vars_files:
|
||
|
- vars.yml.private
|
||
|
become: yes
|
||
|
tasks:
|
||
|
|
||
5 years ago
|
- name: get docker ip
|
||
|
shell: ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+'
|
||
|
register: docker_ip
|
||
|
|
||
5 years ago
|
- name: traefik.toml
|
||
|
copy:
|
||
|
content: |
|
||
|
debug = false
|
||
|
insecureSkipVerify = true
|
||
|
|
||
5 years ago
|
logLevel = "INFO" # "ERROR"
|
||
5 years ago
|
defaultEntryPoints = ["https","http"]
|
||
|
|
||
|
[entryPoints]
|
||
|
[entryPoints.http]
|
||
|
address = ":80"
|
||
|
[entryPoints.http.redirect]
|
||
|
entryPoint = "https"
|
||
|
[entryPoints.https]
|
||
|
address = ":443"
|
||
|
[entryPoints.https.tls]
|
||
|
|
||
|
[retry]
|
||
|
|
||
5 years ago
|
[file]
|
||
|
|
||
|
[frontends]
|
||
|
[frontends.homeassistant]
|
||
|
backend = "homeassistant"
|
||
|
[frontends.homeassistant.routes.test_1]
|
||
|
rule = "Host:{{ home_assistant.host }}"
|
||
|
|
||
|
[backends]
|
||
|
[backends.homeassistant]
|
||
|
[backends.homeassistant.servers.server1]
|
||
|
url = "http://{{ docker_ip.stdout | trim }}:8123"
|
||
|
|
||
5 years ago
|
[docker]
|
||
|
endpoint = "unix:///var/run/docker.sock"
|
||
|
domain = "{{ traefik.domain }}"
|
||
|
watch = true
|
||
|
exposedByDefault = false
|
||
|
network = "attitudeadjuster_bridge"
|
||
|
|
||
|
[acme]
|
||
|
email = "{{ traefik.email }}"
|
||
|
storage = "acme.json"
|
||
|
entryPoint = "https"
|
||
|
onHostRule = true
|
||
|
[acme.httpChallenge]
|
||
|
entryPoint = "http"
|
||
|
dest: /opt/traefik/traefik.toml
|
||
5 years ago
|
notify: restart traefik
|
||
5 years ago
|
|
||
|
- name: acme.json
|
||
|
file:
|
||
|
name: /opt/traefik/acme.json
|
||
|
mode: 0600
|
||
|
state: touch
|
||
5 years ago
|
|
||
|
handlers:
|
||
|
|
||
|
- name: restart traefik
|
||
|
docker_container:
|
||
|
name: traefik
|
||
|
restart: yes
|
||
|
ignore_errors: yes
|
||
|
|