Added syncthing,grafana and wireguard
Signed-off-by: TuDatTr <tuan-dat.tran@tudattr.dev>pull/1/head
parent
cbb3bfd854
commit
2ba4259dd6
|
@ -118,8 +118,8 @@ Endpoint = tudattr.dev:51820
|
||||||
AllowedIPs = 0.0.0.0/0
|
AllowedIPs = 0.0.0.0/0
|
||||||
```
|
```
|
||||||
used ipv4:
|
used ipv4:
|
||||||
- genesis: 192.168.200.250
|
- tudattr: 192.168.200.250
|
||||||
- xiaomi: 192.168.200.249
|
- livei: 192.168.200.240
|
||||||
|
|
||||||
#### notes
|
#### notes
|
||||||
- wireguard->add
|
- wireguard->add
|
||||||
|
@ -142,4 +142,4 @@ when problems with docker: `docker system prune -a`
|
||||||
|
|
||||||
## Todo
|
## Todo
|
||||||
- Role to load customization/configurations from backup to servers
|
- Role to load customization/configurations from backup to servers
|
||||||
- split docker containers to different composes
|
- split docker containers to different composes or tag
|
||||||
|
|
|
@ -9,3 +9,5 @@
|
||||||
- backup
|
- backup
|
||||||
- role: power_management
|
- role: power_management
|
||||||
- role: docker
|
- role: docker
|
||||||
|
tags:
|
||||||
|
- reload_compose
|
||||||
|
|
|
@ -5,6 +5,8 @@ user: tudattr
|
||||||
timezone: Europe/Berlin
|
timezone: Europe/Berlin
|
||||||
local_domain: borg.land
|
local_domain: borg.land
|
||||||
rclone_config: "/root/.config/rclone/"
|
rclone_config: "/root/.config/rclone/"
|
||||||
|
puid: 1000
|
||||||
|
pgid: 1000
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -55,7 +57,13 @@ mysql_user: user
|
||||||
#
|
#
|
||||||
|
|
||||||
zoneminder_config: "{{ docker_dir }}/zm/"
|
zoneminder_config: "{{ docker_dir }}/zm/"
|
||||||
zoneminder_data: "{{ docker_data_dir }}/zm/data"
|
zoneminder_data: "{{ docker_data_dir }}/zm/data/"
|
||||||
|
|
||||||
|
syncthing_data: "{{docker_data_dir}}/syncthing/"
|
||||||
|
|
||||||
|
grafana_data: "{{docker_data_dir}}/grafana/"
|
||||||
|
grafana_log: "{{docker_dir}}/grafana/logs/"
|
||||||
|
grafana_config: "{{docker_dir}}/grafana/config/"
|
||||||
|
|
||||||
#
|
#
|
||||||
# pi
|
# pi
|
||||||
|
@ -68,6 +76,8 @@ ha_config: "{{ docker_dir }}/home-assistant/config/"
|
||||||
|
|
||||||
pihole_pihole: "{{ docker_dir }}/pihole/etc-pihole/"
|
pihole_pihole: "{{ docker_dir }}/pihole/etc-pihole/"
|
||||||
pihole_dnsmasq: "{{ docker_dir }}/pihole/etc-dnsmasq.d/"
|
pihole_dnsmasq: "{{ docker_dir }}/pihole/etc-dnsmasq.d/"
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# backblaze
|
# backblaze
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,9 +1,17 @@
|
||||||
---
|
---
|
||||||
|
- name: Shut down docker
|
||||||
|
shell:
|
||||||
|
cmd: "docker compose down --remove-orphans"
|
||||||
|
chdir: "{{ docker_compose_dir }}"
|
||||||
|
|
||||||
- name: Backing up for "{{ inventory_hostname }}"
|
- name: Backing up for "{{ inventory_hostname }}"
|
||||||
shell:
|
shell:
|
||||||
cmd: "rclone sync {{ item.1 }} secret:{{ item.1 }}"
|
cmd: "rclone sync {{ item.1 }} secret:{{ item.1 }}"
|
||||||
when: item.0.key == inventory_hostname
|
when: item.0.key == inventory_hostname
|
||||||
loop: "{{ backblaze_paths | dict2items | subelements('value') }}"
|
loop: "{{ backblaze_paths | dict2items | subelements('value') }}"
|
||||||
become: true
|
become: true
|
||||||
tags:
|
|
||||||
- backup
|
- name: Shut down docker
|
||||||
|
shell:
|
||||||
|
cmd: "docker compose down --remove-orphans"
|
||||||
|
chdir: "{{ docker_compose_dir }}"
|
||||||
|
|
|
@ -3,3 +3,5 @@
|
||||||
- include_tasks: install.yml
|
- include_tasks: install.yml
|
||||||
- include_tasks: config.yml
|
- include_tasks: config.yml
|
||||||
- include_tasks: backup.yml
|
- include_tasks: backup.yml
|
||||||
|
tags:
|
||||||
|
- backup
|
||||||
|
|
|
@ -20,12 +20,34 @@
|
||||||
file:
|
file:
|
||||||
path: "{{ item }}"
|
path: "{{ item }}"
|
||||||
owner: 911
|
owner: 911
|
||||||
mode: '766'
|
mode: '755'
|
||||||
state: directory
|
state: directory
|
||||||
loop:
|
loop:
|
||||||
- "{{ zoneminder_data }}"
|
- "{{ zoneminder_data }}"
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
|
- name: Create syncthing directory
|
||||||
|
file:
|
||||||
|
path: "{{ item }}"
|
||||||
|
owner: 1000
|
||||||
|
mode: '755'
|
||||||
|
state: directory
|
||||||
|
loop:
|
||||||
|
- "{{ syncthing_data }}"
|
||||||
|
become: true
|
||||||
|
|
||||||
|
- name: Create grafana data directory
|
||||||
|
file:
|
||||||
|
path: "{{ item }}"
|
||||||
|
owner: 1000
|
||||||
|
mode: '755'
|
||||||
|
state: directory
|
||||||
|
loop:
|
||||||
|
- "{{ grafana_data }}"
|
||||||
|
- "{{ grafana_log }}"
|
||||||
|
- "{{ grafana_config}}"
|
||||||
|
become: true
|
||||||
|
|
||||||
# Todo, check if docker compose is running
|
# Todo, check if docker compose is running
|
||||||
# - name: Shut down docker
|
# - name: Shut down docker
|
||||||
# shell:
|
# shell:
|
||||||
|
@ -36,8 +58,12 @@
|
||||||
template:
|
template:
|
||||||
src: templates/aya01/compose.yaml
|
src: templates/aya01/compose.yaml
|
||||||
dest: "{{ docker_compose_dir }}/compose.yaml"
|
dest: "{{ docker_compose_dir }}/compose.yaml"
|
||||||
|
tags:
|
||||||
|
- reload_compose
|
||||||
|
|
||||||
- name: Run docker compose
|
- name: Run docker compose
|
||||||
shell:
|
shell:
|
||||||
cmd: "docker compose up -d"
|
cmd: "docker compose up -d"
|
||||||
chdir: "{{ docker_compose_dir }}"
|
chdir: "{{ docker_compose_dir }}"
|
||||||
|
tags:
|
||||||
|
- reload_compose
|
||||||
|
|
|
@ -3,5 +3,9 @@
|
||||||
- include_tasks: user_group_setup.yml
|
- include_tasks: user_group_setup.yml
|
||||||
- include_tasks: pi_compose.yml
|
- include_tasks: pi_compose.yml
|
||||||
when: inventory_hostname == "pi"
|
when: inventory_hostname == "pi"
|
||||||
|
tags:
|
||||||
|
- reload_compose
|
||||||
- include_tasks: aya01_compose.yml
|
- include_tasks: aya01_compose.yml
|
||||||
when: inventory_hostname == "aya01"
|
when: inventory_hostname == "aya01"
|
||||||
|
tags:
|
||||||
|
- reload_compose
|
||||||
|
|
|
@ -55,8 +55,12 @@
|
||||||
template:
|
template:
|
||||||
src: templates/pi/compose.yaml
|
src: templates/pi/compose.yaml
|
||||||
dest: "{{ docker_compose_dir }}/compose.yaml"
|
dest: "{{ docker_compose_dir }}/compose.yaml"
|
||||||
|
tags:
|
||||||
|
- reload_compose
|
||||||
|
|
||||||
- name: Run docker compose
|
- name: Run docker compose
|
||||||
shell:
|
shell:
|
||||||
cmd: "docker compose up -d"
|
cmd: "docker compose up -d"
|
||||||
chdir: "{{ docker_compose_dir }}"
|
chdir: "{{ docker_compose_dir }}"
|
||||||
|
tags:
|
||||||
|
- reload_compose
|
||||||
|
|
|
@ -76,7 +76,39 @@ services:
|
||||||
- "traefik.http.routers.pihole.rule=Host(`pihole.{{local_domain}}`)"
|
- "traefik.http.routers.pihole.rule=Host(`pihole.{{local_domain}}`)"
|
||||||
- "traefik.http.routers.pihole.entrypoints=web"
|
- "traefik.http.routers.pihole.entrypoints=web"
|
||||||
- "traefik.http.services.pihole.loadbalancer.server.port=8089"
|
- "traefik.http.services.pihole.loadbalancer.server.port=8089"
|
||||||
|
syncthing:
|
||||||
|
image: syncthing/syncthing
|
||||||
|
container_name: syncthing
|
||||||
|
hostname: syncthing
|
||||||
|
networks:
|
||||||
|
- net
|
||||||
|
environment:
|
||||||
|
- PUID=1000
|
||||||
|
- PGID=1000
|
||||||
|
volumes:
|
||||||
|
- "{{syncthing_data}}:/var/syncthing"
|
||||||
|
ports:
|
||||||
|
- 8384:8384 # Web UI
|
||||||
|
- 22000:22000/tcp # TCP file transfers
|
||||||
|
- 22000:22000/udp # QUIC file transfers
|
||||||
|
- 21027:21027/udp # Receive local discovery broadcasts
|
||||||
|
restart: unless-stopped
|
||||||
|
grafana:
|
||||||
|
image: grafana/grafana-oss
|
||||||
|
container_name: grafana
|
||||||
|
hostname: grafana
|
||||||
|
networks:
|
||||||
|
- net
|
||||||
|
environment:
|
||||||
|
- "PUID={{ puid }}"
|
||||||
|
- "PGID={{ pgid }}"
|
||||||
|
- "GF_LOG_MODE=console file"
|
||||||
|
volumes:
|
||||||
|
- "{{ grafana_data }}:/var/lib/grafana/"
|
||||||
|
- "{{ grafana_log }}:/var/log/grafana/"
|
||||||
|
- "{{ grafana_config }}:/etc/grafana/"
|
||||||
|
ports:
|
||||||
|
- 3000:3000
|
||||||
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
|
|
|
@ -18,8 +18,8 @@ services:
|
||||||
labels:
|
labels:
|
||||||
- "traefik.enable=true"
|
- "traefik.enable=true"
|
||||||
- "traefik.http.routers.traefik.rule=Host(`traefik.{{local_domain}}`)"
|
- "traefik.http.routers.traefik.rule=Host(`traefik.{{local_domain}}`)"
|
||||||
- "traefik.http.routers.traefik.entrypoints=web"
|
# - "traefik.http.routers.traefik.entrypoints=web"
|
||||||
- "traefik.http.services.traefik.loadbalancer.server.port=80"
|
# - "traefik.http.services.traefik.loadbalancer.server.port=80"
|
||||||
ddns-updater:
|
ddns-updater:
|
||||||
container_name: ddns-updater
|
container_name: ddns-updater
|
||||||
image: "ghcr.io/qdm12/ddns-updater"
|
image: "ghcr.io/qdm12/ddns-updater"
|
||||||
|
@ -34,17 +34,21 @@ services:
|
||||||
container_name: homeassistant
|
container_name: homeassistant
|
||||||
image: "ghcr.io/home-assistant/home-assistant:stable"
|
image: "ghcr.io/home-assistant/home-assistant:stable"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
# network_mode: host
|
||||||
volumes:
|
volumes:
|
||||||
- "/etc/localtime:/etc/localtime:ro"
|
- "/etc/localtime:/etc/localtime:ro"
|
||||||
- "{{ ha_config }}:/config/"
|
- "{{ ha_config }}:/config/"
|
||||||
privileged: true
|
privileged: true
|
||||||
ports:
|
ports:
|
||||||
- 8123:8123
|
- 8123:8123
|
||||||
|
- 4357:4357
|
||||||
|
- 5683:5683
|
||||||
|
- 5683:5683/udp
|
||||||
labels:
|
labels:
|
||||||
- "traefik.enable=true"
|
- "traefik.enable=true"
|
||||||
- "traefik.http.routers.homeassistant.rule=Host(`hass.{{local_domain}}`)"
|
- "traefik.http.routers.homeassistant.rule=Host(`hass.{{local_domain}}`)"
|
||||||
- "traefik.http.routers.homeassistant.entrypoints=web"
|
# - "traefik.http.routers.homeassistant.entrypoints=web"
|
||||||
- "traefik.http.services.homeassistant.loadbalancer.server.port=8123"
|
# - "traefik.http.services.homeassistant.loadbalancer.server.port=8123"
|
||||||
pihole:
|
pihole:
|
||||||
container_name: pihole
|
container_name: pihole
|
||||||
image: pihole/pihole:latest
|
image: pihole/pihole:latest
|
||||||
|
@ -74,8 +78,8 @@ services:
|
||||||
labels:
|
labels:
|
||||||
- "traefik.enable=true"
|
- "traefik.enable=true"
|
||||||
- "traefik.http.routers.pihole.rule=Host(`pihole.{{local_domain}}`)"
|
- "traefik.http.routers.pihole.rule=Host(`pihole.{{local_domain}}`)"
|
||||||
- "traefik.http.routers.pihole.entrypoints=web"
|
# - "traefik.http.routers.pihole.entrypoints=web"
|
||||||
- "traefik.http.services.pihole.loadbalancer.server.port=8089"
|
# - "traefik.http.services.pihole.loadbalancer.server.port=8089"
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
net:
|
net:
|
||||||
|
|
Loading…
Reference in New Issue