|
|
@ -29,6 +29,7 @@
|
|
|
|
state: directory
|
|
|
|
state: directory
|
|
|
|
with_items:
|
|
|
|
with_items:
|
|
|
|
- /etc/ddclient
|
|
|
|
- /etc/ddclient
|
|
|
|
|
|
|
|
- /etc/minio
|
|
|
|
- /etc/traefik
|
|
|
|
- /etc/traefik
|
|
|
|
- /mnt/mushu/minio
|
|
|
|
- /mnt/mushu/minio
|
|
|
|
- /mnt/mushu/syncthing
|
|
|
|
- /mnt/mushu/syncthing
|
|
|
@ -86,32 +87,16 @@
|
|
|
|
dest: /etc/traefik/traefik.toml
|
|
|
|
dest: /etc/traefik/traefik.toml
|
|
|
|
mode: 0600
|
|
|
|
mode: 0600
|
|
|
|
|
|
|
|
|
|
|
|
# TODO This should really go after the docker_compose task, since it
|
|
|
|
# The docker_compose module overwrites our existing variables, so this is a
|
|
|
|
# depends on the network that docker-compose makes. We should create the
|
|
|
|
# workaround to save off ones that we need later on in the playbook.
|
|
|
|
# network first so we can do this, and set the services to use that network
|
|
|
|
#
|
|
|
|
# specifically.
|
|
|
|
# https://github.com/ansible/ansible/issues/33960
|
|
|
|
- name: Route Home Assistant through Traefik
|
|
|
|
- name: Save original host facts
|
|
|
|
block:
|
|
|
|
set_fact:
|
|
|
|
# - shell: ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+' | head -n 1
|
|
|
|
"{{ item }}_original": "{{ lookup('vars', item) }}"
|
|
|
|
- shell: docker network inspect on-fire-within_default | jq --raw-output .[0].IPAM.Config[0].Gateway
|
|
|
|
with_items:
|
|
|
|
register: docker_ip_result
|
|
|
|
- minio
|
|
|
|
- set_fact:
|
|
|
|
- traefik
|
|
|
|
docker_ip: "{{ docker_ip_result.stdout | trim }}"
|
|
|
|
|
|
|
|
- copy:
|
|
|
|
|
|
|
|
content: |
|
|
|
|
|
|
|
|
[http.routers]
|
|
|
|
|
|
|
|
[http.routers.hassio]
|
|
|
|
|
|
|
|
rule = "Host(`{{ traefik.host_rules.hassio }}`)"
|
|
|
|
|
|
|
|
service = "hassio"
|
|
|
|
|
|
|
|
[http.routers.hassio.tls]
|
|
|
|
|
|
|
|
certResolver = "le"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[http.services]
|
|
|
|
|
|
|
|
[http.services.hassio.loadBalancer]
|
|
|
|
|
|
|
|
[[http.services.hassio.loadBalancer.servers]]
|
|
|
|
|
|
|
|
url = "http://{{ docker_ip }}:8123/"
|
|
|
|
|
|
|
|
dest: /etc/traefik/dynamic_conf.toml
|
|
|
|
|
|
|
|
mode: 0600
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Docker ALL the things!
|
|
|
|
- name: Docker ALL the things!
|
|
|
|
docker_compose:
|
|
|
|
docker_compose:
|
|
|
@ -129,12 +114,11 @@
|
|
|
|
minio:
|
|
|
|
minio:
|
|
|
|
image: kejadlen/minio:latest
|
|
|
|
image: kejadlen/minio:latest
|
|
|
|
container_name: minio
|
|
|
|
container_name: minio
|
|
|
|
ports:
|
|
|
|
|
|
|
|
- 9000:9000/tcp
|
|
|
|
|
|
|
|
environment:
|
|
|
|
environment:
|
|
|
|
MINIO_ACCESS_KEY: "{{ minio.access_key }}"
|
|
|
|
MINIO_ACCESS_KEY: "{{ minio.access_key }}"
|
|
|
|
MINIO_SECRET_KEY: "{{ minio.secret_key }}"
|
|
|
|
MINIO_SECRET_KEY: "{{ minio.secret_key }}"
|
|
|
|
volumes:
|
|
|
|
volumes:
|
|
|
|
|
|
|
|
- /etc/minio:/root/.minio
|
|
|
|
- /mnt/mushu/minio:/data
|
|
|
|
- /mnt/mushu/minio:/data
|
|
|
|
user: 0:0 # root
|
|
|
|
user: 0:0 # root
|
|
|
|
labels:
|
|
|
|
labels:
|
|
|
@ -202,6 +186,29 @@
|
|
|
|
- traefik.http.routers.traefik.service=api@internal
|
|
|
|
- traefik.http.routers.traefik.service=api@internal
|
|
|
|
restart: unless-stopped
|
|
|
|
restart: unless-stopped
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Route Home Assistant through Traefik
|
|
|
|
|
|
|
|
block:
|
|
|
|
|
|
|
|
# - shell: ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+' | head -n 1
|
|
|
|
|
|
|
|
- shell: docker network inspect on-fire-within_default | jq --raw-output .[0].IPAM.Config[0].Gateway
|
|
|
|
|
|
|
|
register: docker_ip_result
|
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
|
|
|
|
docker_ip: "{{ docker_ip_result.stdout | trim }}"
|
|
|
|
|
|
|
|
- copy:
|
|
|
|
|
|
|
|
content: |
|
|
|
|
|
|
|
|
[http.routers]
|
|
|
|
|
|
|
|
[http.routers.hassio]
|
|
|
|
|
|
|
|
rule = "Host(`{{ traefik_original.host_rules.hassio }}`)"
|
|
|
|
|
|
|
|
service = "hassio"
|
|
|
|
|
|
|
|
[http.routers.hassio.tls]
|
|
|
|
|
|
|
|
certResolver = "le"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[http.services]
|
|
|
|
|
|
|
|
[http.services.hassio.loadBalancer]
|
|
|
|
|
|
|
|
[[http.services.hassio.loadBalancer.servers]]
|
|
|
|
|
|
|
|
url = "http://{{ docker_ip }}:8123/"
|
|
|
|
|
|
|
|
dest: /etc/traefik/dynamic_conf.toml
|
|
|
|
|
|
|
|
mode: 0600
|
|
|
|
|
|
|
|
|
|
|
|
handlers:
|
|
|
|
handlers:
|
|
|
|
- name: Restart ddclient
|
|
|
|
- name: Restart ddclient
|
|
|
|
docker_container:
|
|
|
|
docker_container:
|
|
|
|