[ansible] syncthing on on-fire-within

pull/28/head
Alpha Chen 5 years ago
parent 820be8c203
commit 7c85f31cc0

@ -4,7 +4,7 @@
- hosts: on_fire_within - hosts: on_fire_within
become: yes become: yes
tasks: tasks:
- name: install dependencies - name: Install dependencies
apt: apt:
name: name:
- git - git
@ -16,22 +16,31 @@
- python-backports-shutil-get-terminal-size - python-backports-shutil-get-terminal-size
- python-backports.ssl-match-hostname - python-backports.ssl-match-hostname
- name: install python docker packages - name: Install python docker packages
pip: pip:
name: name:
- docker - docker
- docker-compose - docker-compose
state: latest state: latest
- name: create conf dirs - name: Create necessary dirs
file: file:
path: "{{ item }}" path: "{{ item }}"
state: directory state: directory
with_items: with_items:
- /etc/ddclient - /etc/ddclient
- /etc/traefik - /etc/traefik
- /mnt/mushu/minio
- /mnt/mushu/syncthing
- name: configure ddclient - name: Mount USB drive
mount:
path: /mnt/mushu
src: /dev/sda
fstype: ext4
state: mounted
- name: Configure ddclient
copy: copy:
content: | content: |
daemon=300 daemon=300
@ -47,9 +56,9 @@
mode: 0600 mode: 0600
vars: vars:
hosts: "{{ ddclient.hosts }}" hosts: "{{ ddclient.hosts }}"
notify: restart ddclient notify: Restart ddclient
- name: traefik static configuration - name: Traefik static configuration
copy: copy:
content: | content: |
[providers] [providers]
@ -81,7 +90,7 @@
# depends on the network that docker-compose makes. We should create the # depends on the network that docker-compose makes. We should create the
# network first so we can do this, and set the services to use that network # network first so we can do this, and set the services to use that network
# specifically. # specifically.
- name: traefik dynamic configuration - name: Route Home Assistant through Traefik
block: block:
# - shell: ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+' | head -n 1 # - 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 - shell: docker network inspect on-fire-within_default | jq --raw-output .[0].IPAM.Config[0].Gateway
@ -104,7 +113,7 @@
dest: /etc/traefik/dynamic_conf.toml dest: /etc/traefik/dynamic_conf.toml
mode: 0600 mode: 0600
- name: docker all the things! - name: Docker ALL the things!
docker_compose: docker_compose:
project_name: on-fire-within project_name: on-fire-within
pull: yes pull: yes
@ -117,6 +126,23 @@
volumes: volumes:
- /etc/ddclient:/etc/ddclient - /etc/ddclient:/etc/ddclient
restart: unless-stopped restart: unless-stopped
minio:
image: kejadlen/minio:latest
container_name: minio
ports:
- 9000:9000/tcp
environment:
MINIO_ACCESS_KEY: "{{ minio.access_key }}"
MINIO_SECRET_KEY: "{{ minio.secret_key }}"
volumes:
- /mnt/mushu/minio:/data
user: 0:0 # root
labels:
- traefik.enable=true
- traefik.http.routers.minio.rule=Host(`{{ traefik.host_rules.minio }}`)
- traefik.http.routers.minio.tls=true
- traefik.http.routers.minio.tls.certresolver=le
- traefik.http.services.minio.loadbalancer.server.port=9000
pihole: pihole:
image: pihole/pihole:latest image: pihole/pihole:latest
container_name: pihole container_name: pihole
@ -148,6 +174,8 @@
- 21027:21027/udp - 21027:21027/udp
volumes: volumes:
- /etc/syncthing:/etc/syncthing - /etc/syncthing:/etc/syncthing
- /mnt/mushu/syncthing:/sync
user: 0:0 # root
labels: labels:
- traefik.enable=true - traefik.enable=true
- traefik.http.routers.syncthing.rule=Host(`{{ traefik.host_rules.syncthing }}`) - traefik.http.routers.syncthing.rule=Host(`{{ traefik.host_rules.syncthing }}`)
@ -175,7 +203,7 @@
restart: unless-stopped restart: unless-stopped
handlers: handlers:
- name: restart ddclient - name: Restart ddclient
docker_container: docker_container:
name: ddclient name: ddclient
restart: yes restart: yes

Loading…
Cancel
Save