why are they still here?
This commit is contained in:
parent
ffa5a84527
commit
cad65ee99a
@ -1 +0,0 @@
|
|||||||
# ddns
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
path: /srv/{{ role_name }}
|
|
||||||
|
|
||||||
ddns_override: {}
|
|
||||||
ddns_defaults:
|
|
||||||
version: latest
|
|
||||||
domains: {}
|
|
||||||
# - provider: ""
|
|
||||||
# domain: ""
|
|
||||||
# ip_version: ""
|
|
||||||
# token: ""
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
- name: restart container
|
|
||||||
community.docker.docker_compose_v2:
|
|
||||||
project_src: "{{ path }}"
|
|
||||||
project_name: "{{ role_name }}"
|
|
||||||
recreate: "always"
|
|
||||||
state: "restarted"
|
|
||||||
services: ["ddns"]
|
|
||||||
when: not _ddns_already_restarted
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
---
|
|
||||||
galaxy_info:
|
|
||||||
author: "Niklas Freese <niklas@urmel.de>"
|
|
||||||
description: DDNS
|
|
||||||
company: "Urmel Services"
|
|
||||||
license: AGPL-3.0-or-later
|
|
||||||
min_ansible_version: 2.1
|
|
||||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
|
||||||
# min_ansible_container_version:
|
|
||||||
|
|
||||||
galaxy_tags: []
|
|
||||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
|
||||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
|
||||||
# remove the '[]' above, if you add tags to this list.
|
|
||||||
#
|
|
||||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
|
||||||
# Maximum 20 tags per role.
|
|
||||||
|
|
||||||
dependencies: []
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
---
|
|
||||||
- name: "set local variables from overrides and defaults"
|
|
||||||
set_fact:
|
|
||||||
ddns: "{{ (ddns_defaults | combine(ddns_override, recursive=True)) if ddns_override else ddns_defaults }}"
|
|
||||||
|
|
||||||
- name: ensure that path exists
|
|
||||||
file:
|
|
||||||
path: "{{ path }}"
|
|
||||||
state: directory
|
|
||||||
|
|
||||||
- name: template docker-compose
|
|
||||||
template:
|
|
||||||
src: compose.yml.j2
|
|
||||||
dest: "{{ path }}/compose.yml"
|
|
||||||
notify: restart container
|
|
||||||
|
|
||||||
- name: ensure container is running
|
|
||||||
community.docker.docker_compose_v2:
|
|
||||||
project_src: "{{ path }}"
|
|
||||||
project_name: "{{ role_name }}"
|
|
||||||
state: "present"
|
|
||||||
pull: "always"
|
|
||||||
wait: true
|
|
||||||
services: ["ddns"]
|
|
||||||
register: _compose_result
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
services:
|
|
||||||
ddns:
|
|
||||||
image: qmcgaw/ddns-updater:{{ ddns.version }}
|
|
||||||
restart: always
|
|
||||||
network_mode: bridge
|
|
||||||
environment:
|
|
||||||
RESOLVER_ADDRESS: 1.1.1.1:53
|
|
||||||
{% set config = {'settings': ddns.domains} | to_json -%}
|
|
||||||
CONFIG: '{{ config }}'
|
|
||||||
# ports:
|
|
||||||
# - 8999:8000
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
# homeassistant
|
|
||||||
|
|
||||||
Note: Homeassistant sometimes expectes .yaml NOT .yml
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
path: /srv/{{ role_name }}
|
|
||||||
|
|
||||||
homeassistant_override: {}
|
|
||||||
homeassistant_defaults:
|
|
||||||
url: ""
|
|
||||||
version: latest
|
|
||||||
proxy_ip: ""
|
|
||||||
mqtt:
|
|
||||||
zigbee2mqtt:
|
|
||||||
version: latest
|
|
||||||
domain: ""
|
|
||||||
auth_token: ""
|
|
||||||
zigbee_adapter_id: ""
|
|
||||||
mosquitto:
|
|
||||||
version: latest
|
|
||||||
allow_anonymous: true
|
|
||||||
oidc:
|
|
||||||
client_id: ""
|
|
||||||
client_secret: ""
|
|
||||||
configure_url: ""
|
|
||||||
mariadb:
|
|
||||||
password: ""
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
- name: restart container
|
|
||||||
community.docker.docker_compose_v2:
|
|
||||||
project_src: "{{ path }}"
|
|
||||||
project_name: "{{ role_name }}"
|
|
||||||
recreate: "always"
|
|
||||||
services: ["homeassistant"]
|
|
||||||
state: "restarted"
|
|
||||||
when: not _homeassistant_already_restarted
|
|
||||||
@ -1,20 +0,0 @@
|
|||||||
---
|
|
||||||
galaxy_info:
|
|
||||||
author: "Niklas Freese <niklas@urmel.de>"
|
|
||||||
description: homeassistant
|
|
||||||
company: "Urmel Services"
|
|
||||||
license: AGPL-3.0-or-later
|
|
||||||
min_ansible_version: 2.1
|
|
||||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
|
||||||
# min_ansible_container_version:
|
|
||||||
|
|
||||||
galaxy_tags: []
|
|
||||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
|
||||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
|
||||||
# remove the '[]' above, if you add tags to this list.
|
|
||||||
#
|
|
||||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
|
||||||
# Maximum 20 tags per role.
|
|
||||||
|
|
||||||
dependencies:
|
|
||||||
- role: traefik
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
- name: Find Home Assistant configuration templates locally
|
|
||||||
ansible.builtin.set_fact:
|
|
||||||
ha_templates: "{{ query('ansible.builtin.fileglob', role_path + '/templates/homeassistant_configuration/*.yaml.j2') }}"
|
|
||||||
|
|
||||||
- name: Template Home Assistant configuration files
|
|
||||||
ansible.builtin.template:
|
|
||||||
src: "{{ item }}"
|
|
||||||
dest: "/srv/homeassistant/config/homeassistant/{{ item | basename | regex_replace('\\.j2$', '') }}"
|
|
||||||
mode: "0644"
|
|
||||||
loop: "{{ ha_templates }}"
|
|
||||||
loop_control:
|
|
||||||
label: "{{ item | basename }}"
|
|
||||||
|
|
||||||
- name: Ensure Home Assistant configuration.yaml exists
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: "/srv/homeassistant/config/homeassistant/configuration.yaml"
|
|
||||||
state: touch
|
|
||||||
mode: "0644"
|
|
||||||
modification_time: preserve
|
|
||||||
access_time: preserve
|
|
||||||
|
|
||||||
- name: Add Home Assistant configuration includes
|
|
||||||
ansible.builtin.blockinfile:
|
|
||||||
path: "/srv/homeassistant/config/homeassistant/configuration.yaml"
|
|
||||||
marker: "# {mark} ANSIBLE MANAGED CONFIGURATION INCLUDES"
|
|
||||||
insertafter: EOF
|
|
||||||
block: |
|
|
||||||
{% for item in ha_templates | sort %}
|
|
||||||
{{ item | basename | regex_replace('\.yaml\.j2$', '') }}: !include {{ item | basename | regex_replace('\.j2$', '') }}
|
|
||||||
{% endfor %}
|
|
||||||
@ -1,68 +0,0 @@
|
|||||||
---
|
|
||||||
- name: "set local variables from overrides and defaults"
|
|
||||||
set_fact:
|
|
||||||
homeassistant: "{{ (homeassistant_defaults | combine(homeassistant_override, recursive=True)) if homeassistant_override else homeassistant_defaults }}"
|
|
||||||
|
|
||||||
- name: ensure that path exists
|
|
||||||
file:
|
|
||||||
path: "{{ path }}/config/homeassistant"
|
|
||||||
state: directory
|
|
||||||
|
|
||||||
- name: ensure that mosquitto config path exists
|
|
||||||
file:
|
|
||||||
path: "{{ path }}/config/mosquitto"
|
|
||||||
state: directory
|
|
||||||
|
|
||||||
- name: ensure that mosquitto data path exists
|
|
||||||
file:
|
|
||||||
path: "{{ item }}"
|
|
||||||
state: directory
|
|
||||||
owner: "1883"
|
|
||||||
group: "1883"
|
|
||||||
loop:
|
|
||||||
- "{{ path }}/data/mosquitto"
|
|
||||||
- "{{ path }}/data/mosquitto/log"
|
|
||||||
|
|
||||||
- name: ensure that zigbee2mqtt data path exists
|
|
||||||
file:
|
|
||||||
path: "{{ path }}/data/zigbee2mqtt"
|
|
||||||
state: directory
|
|
||||||
|
|
||||||
- name: template docker-compose
|
|
||||||
template:
|
|
||||||
src: compose.yml.j2
|
|
||||||
dest: "{{ path }}/compose.yml"
|
|
||||||
|
|
||||||
- name: template .env
|
|
||||||
template:
|
|
||||||
src: .env.j2
|
|
||||||
dest: "{{ path }}/.env"
|
|
||||||
|
|
||||||
- name: template mosquitto config
|
|
||||||
template:
|
|
||||||
src: mosquitto.conf.j2
|
|
||||||
dest: "{{ path }}/config/mosquitto/mosquitto.conf"
|
|
||||||
mode: "0644"
|
|
||||||
|
|
||||||
- name: template zigbee2mqtt config
|
|
||||||
ansible.builtin.blockinfile:
|
|
||||||
path: "{{ path }}/data/zigbee2mqtt/configuration.yaml"
|
|
||||||
create: true
|
|
||||||
mode: "0644"
|
|
||||||
marker: "# Ansible {mark}"
|
|
||||||
marker_begin: start
|
|
||||||
marker_end: end
|
|
||||||
block: "{{ lookup('template', 'zigbee2mqtt/configuration.yaml.j2') }}"
|
|
||||||
|
|
||||||
- name: Do configuration
|
|
||||||
include_tasks: ensure_configuration.yml
|
|
||||||
|
|
||||||
- name: ensure container is running
|
|
||||||
community.docker.docker_compose_v2:
|
|
||||||
project_src: "{{ path }}"
|
|
||||||
project_name: "{{ role_name }}"
|
|
||||||
state: "present"
|
|
||||||
pull: "always"
|
|
||||||
wait: true
|
|
||||||
services: ["mariadb", "mosquitto", "homeassistant", "zigbee2mqtt"]
|
|
||||||
register: _compose_result
|
|
||||||
@ -1 +0,0 @@
|
|||||||
SUBNET=172.31.254
|
|
||||||
@ -1,152 +0,0 @@
|
|||||||
version: '3'
|
|
||||||
|
|
||||||
services:
|
|
||||||
homeassistant:
|
|
||||||
image: homeassistant/home-assistant:{{ homeassistant.version }}
|
|
||||||
volumes:
|
|
||||||
# We do not yes manage configs with ansible
|
|
||||||
- ./config/homeassistant:/config
|
|
||||||
- /etc/localtime:/etc/localtime:ro
|
|
||||||
restart: unless-stopped
|
|
||||||
environment:
|
|
||||||
TZ: Europe/Berlin
|
|
||||||
network_mode: "host"
|
|
||||||
# networks:
|
|
||||||
# local_network:
|
|
||||||
# ipv4_address: ${SUBNET}.2
|
|
||||||
depends_on:
|
|
||||||
- zigbee2mqtt
|
|
||||||
- mariadb
|
|
||||||
- mosquitto
|
|
||||||
extra_hosts:
|
|
||||||
- "zwave:${SUBNET}.3"
|
|
||||||
- "zigbee2mqtt:${SUBNET}.6"
|
|
||||||
- "mariadb:${SUBNET}.4"
|
|
||||||
- "mosquitto:${SUBNET}.5"
|
|
||||||
# ports:
|
|
||||||
# - 8123:8123
|
|
||||||
# - 1400:1400
|
|
||||||
# - 1401:1401
|
|
||||||
|
|
||||||
{% if homeassistant.mqtt.zigbee2mqtt.zigbee_adapter_id %}
|
|
||||||
zigbee2mqtt:
|
|
||||||
# 8080
|
|
||||||
image: ghcr.io/koenkk/zigbee2mqtt:{{ homeassistant.mqtt.zigbee2mqtt.version }}
|
|
||||||
restart: unless-stopped
|
|
||||||
volumes:
|
|
||||||
- ./data/zigbee2mqtt:/app/data
|
|
||||||
- /run/udev:/run/udev:ro
|
|
||||||
environment:
|
|
||||||
- TZ=Europe/Berlin
|
|
||||||
networks:
|
|
||||||
local_network:
|
|
||||||
ipv4_address: ${SUBNET}.6
|
|
||||||
exposed:
|
|
||||||
devices:
|
|
||||||
# Make sure this matched your adapter location
|
|
||||||
- /dev/serial/by-id/{{ homeassistant.mqtt.zigbee2mqtt.zigbee_adapter_id }}:/dev/ttyUSB0
|
|
||||||
labels:
|
|
||||||
traefik.enable: true
|
|
||||||
|
|
||||||
traefik.http.routers.homeassistant-mqtt.entrypoints: https
|
|
||||||
traefik.http.routers.homeassistant-mqtt.rule: Host(`{{ homeassistant.mqtt.zigbee2mqtt.domain }}`)
|
|
||||||
traefik.http.services.homeassistant-mqtt.loadbalancer.server.port: 8080
|
|
||||||
traefik.http.routers.homeassistant-mqtt.tls: "true"
|
|
||||||
traefik.http.routers.homeassistant-mqtt.tls.certresolver: hetzner
|
|
||||||
traefik.http.routers.homeassistant-mqtt.middlewares: local-only@file
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if homeassistant.matter.matter_adapter_id %}
|
|
||||||
matter:
|
|
||||||
image: ghcr.io/matter-js/matterjs-server:stable
|
|
||||||
volumes:
|
|
||||||
- ./data/matter:/data
|
|
||||||
networks:
|
|
||||||
local_network:
|
|
||||||
ipv4_address: ${SUBNET}.7
|
|
||||||
exposed:
|
|
||||||
labels:
|
|
||||||
traefik.enable: true
|
|
||||||
|
|
||||||
traefik.http.routers.homeassistant-matter.entrypoints: https
|
|
||||||
traefik.http.routers.homeassistant-matter.rule: Host(`{{ homeassistant.matter.domain }}`)
|
|
||||||
traefik.http.services.homeassistant-matter.loadbalancer.server.port: 5580
|
|
||||||
traefik.http.routers.homeassistant-matter.tls: "true"
|
|
||||||
traefik.http.routers.homeassistant-matter.tls.certresolver: hetzner
|
|
||||||
traefik.http.routers.homeassistant-matter.middlewares: local-only@file
|
|
||||||
openthread:
|
|
||||||
image: openthread/border-router:latest
|
|
||||||
networks:
|
|
||||||
local_network:
|
|
||||||
ipv4_address: ${SUBNET}.8
|
|
||||||
exposed:
|
|
||||||
environment:
|
|
||||||
- TZ=Europe/Berlin
|
|
||||||
- OT_RCP_DEVICE=/dev/ttyUSB0
|
|
||||||
- OT_LOG_LEVEL=7
|
|
||||||
- OT_THREAD_IF=wpan0
|
|
||||||
- OT_INFRA_IF=br0
|
|
||||||
- OT_REST_LISTEN_ADDR=0.0.0.0
|
|
||||||
- OT_REST_LISTEN_PORT=9212
|
|
||||||
volumes:
|
|
||||||
- ./data/openthread:/data
|
|
||||||
devices:
|
|
||||||
# Make sure this matched your adapter location
|
|
||||||
- /dev/serial/by-id/{{ homeassistant.matter.matter_adapter_id }}:/dev/ttyUSB0
|
|
||||||
- /dev/net/tun:/dev/net/tun
|
|
||||||
cap_add:
|
|
||||||
- NET_ADMIN
|
|
||||||
labels:
|
|
||||||
traefik.enable: true
|
|
||||||
|
|
||||||
traefik.http.routers.homeassistant-openthread.entrypoints: https
|
|
||||||
traefik.http.routers.homeassistant-openthread.rule: Host(`{{ homeassistant.matter.openthread_domain }}`)
|
|
||||||
traefik.http.services.homeassistant-openthread.loadbalancer.server.port: 9212
|
|
||||||
traefik.http.routers.homeassistant-openthread.tls: "true"
|
|
||||||
traefik.http.routers.homeassistant-openthread.tls.certresolver: hetzner
|
|
||||||
traefik.http.routers.homeassistant-openthread.middlewares: local-only@file
|
|
||||||
restart: always
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
mosquitto:
|
|
||||||
image: eclipse-mosquitto:{{ homeassistant.mqtt.mosquitto.version }}
|
|
||||||
restart: unless-stopped
|
|
||||||
user: "1883:1883"
|
|
||||||
volumes:
|
|
||||||
- ./config/mosquitto:/mosquitto/config:ro
|
|
||||||
- ./data/mosquitto:/mosquitto/data
|
|
||||||
- ./data/mosquitto/log:/mosquitto/log
|
|
||||||
environment:
|
|
||||||
- TZ=Europe/Berlin
|
|
||||||
networks:
|
|
||||||
local_network:
|
|
||||||
ipv4_address: ${SUBNET}.5
|
|
||||||
|
|
||||||
mariadb:
|
|
||||||
image: mariadb:10.11.2
|
|
||||||
volumes:
|
|
||||||
- ./data/mariadb:/var/lib/mysql
|
|
||||||
- ./config/mariadb:/etc/mysql/conf.d
|
|
||||||
- /etc/localtime:/etc/localtime:ro
|
|
||||||
|
|
||||||
restart: unless-stopped
|
|
||||||
environment:
|
|
||||||
MARIADB_ROOT_PASSWORD: {{ homeassistant.mariadb.password }}
|
|
||||||
MARIADB_MYSQL_LOCALHOST_USER: "yes"
|
|
||||||
MARIADB_MYSQL_LOCALHOST_GRANTS: "yes"
|
|
||||||
MARIADB_AUTO_UPGRADE: "yes"
|
|
||||||
MARIADB_DISABLE_UPGRADE_BACKUP: "yes"
|
|
||||||
TZ: Europe/Berlin
|
|
||||||
networks:
|
|
||||||
local_network:
|
|
||||||
ipv4_address: ${SUBNET}.4
|
|
||||||
|
|
||||||
networks:
|
|
||||||
local_network:
|
|
||||||
ipam:
|
|
||||||
driver: default
|
|
||||||
config:
|
|
||||||
- subnet: ${SUBNET}.0/24
|
|
||||||
exposed:
|
|
||||||
name: traefik_exposed
|
|
||||||
external: true
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
client_id: "{{ homeassistant.oidc.client_id }}"
|
|
||||||
{% if homeassistant.oidc.client_secret %}
|
|
||||||
client_secret: "{{ homeassistant.oidc.client_secret }}"
|
|
||||||
{% endif %}
|
|
||||||
discovery_url: "{{ homeassistant.oidc.configure_url }}"
|
|
||||||
claims:
|
|
||||||
display_name: "preferred_username"
|
|
||||||
groups: groups
|
|
||||||
roles:
|
|
||||||
admin: urmel-admin
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
use_x_forwarded_for: true
|
|
||||||
trusted_proxies:
|
|
||||||
- {{ homeassistant.proxy_ip }}
|
|
||||||
|
|
||||||
# DOSE NOT WORK, MUST BE SET MANUALY AT FIRST BOOT
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
# Ansible managed
|
|
||||||
persistence true
|
|
||||||
persistence_location /mosquitto/data/
|
|
||||||
log_dest file /mosquitto/log/mosquitto.log
|
|
||||||
|
|
||||||
listener 1883
|
|
||||||
protocol mqtt
|
|
||||||
|
|
||||||
allow_anonymous {{ 'true' if homeassistant.mqtt.mosquitto.allow_anonymous else 'false' }}
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
homeassistant:
|
|
||||||
enabled: true
|
|
||||||
mqtt:
|
|
||||||
base_topic: zigbee2mqtt
|
|
||||||
server: 'mqtt://mosquitto:1883'
|
|
||||||
serial:
|
|
||||||
port: /dev/ttyUSB0
|
|
||||||
advanced:
|
|
||||||
log_level: info
|
|
||||||
frontend:
|
|
||||||
enabled: true
|
|
||||||
auth_token: {{ homeassistant.mqtt.zigbee2mqtt.auth_token }}
|
|
||||||
version: 5
|
|
||||||
@ -1 +0,0 @@
|
|||||||
# dns
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
path: /srv/{{ role_name }}
|
|
||||||
|
|
||||||
dns_override: {}
|
|
||||||
dns_defaults:
|
|
||||||
version: "latest"
|
|
||||||
api_key: ""
|
|
||||||
domain: ""
|
|
||||||
local_domains: []
|
|
||||||
domain_host: ""
|
|
||||||
domain_host_v6: ""
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
- name: restart container
|
|
||||||
community.docker.docker_compose_v2:
|
|
||||||
project_src: "{{ path }}"
|
|
||||||
project_name: "{{ role_name }}"
|
|
||||||
recreate: "always"
|
|
||||||
services: ["pihole"]
|
|
||||||
state: "restarted"
|
|
||||||
|
|
||||||
when: _dns_already_restarted is deffined and not _dns_already_restarted
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
---
|
|
||||||
galaxy_info:
|
|
||||||
author: "Niklas Freese <niklas@urmel.de>"
|
|
||||||
description: dns
|
|
||||||
company: "Urmel Services"
|
|
||||||
license: AGPL-3.0-or-later
|
|
||||||
min_ansible_version: 2.1
|
|
||||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
|
||||||
# min_ansible_container_version:
|
|
||||||
|
|
||||||
galaxy_tags: []
|
|
||||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
|
||||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
|
||||||
# remove the '[]' above, if you add tags to this list.
|
|
||||||
#
|
|
||||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
|
||||||
# Maximum 20 tags per role.
|
|
||||||
@ -1,33 +0,0 @@
|
|||||||
---
|
|
||||||
- name: "set local variables from overrides and defaults"
|
|
||||||
set_fact:
|
|
||||||
dns: "{{ (dns_defaults | combine(dns_override, recursive=True)) if dns_override else dns_defaults }}"
|
|
||||||
|
|
||||||
- name: ensure that path exists
|
|
||||||
file:
|
|
||||||
path: "{{ path }}/config/dns"
|
|
||||||
state: directory
|
|
||||||
|
|
||||||
- name: template docker-compose
|
|
||||||
template:
|
|
||||||
src: compose.yml.j2
|
|
||||||
dest: "{{ path }}/compose.yml"
|
|
||||||
|
|
||||||
- name: populate dmasq
|
|
||||||
ansible.builtin.template:
|
|
||||||
src: "dmasq.conf/{{ item.path }}"
|
|
||||||
dest: "{{ path }}/config/etc-dnsmasq.d/{{ item.path | regex_replace('\\.j2$', '') }}"
|
|
||||||
with_filetree: "{{ role_path }}/templates/dmasq.conf"
|
|
||||||
when:
|
|
||||||
- item.state == "file"
|
|
||||||
notify: restart container
|
|
||||||
|
|
||||||
- name: ensure container is running
|
|
||||||
community.docker.docker_compose_v2:
|
|
||||||
project_src: "{{ path }}"
|
|
||||||
project_name: "{{ role_name }}"
|
|
||||||
state: "present"
|
|
||||||
pull: "always"
|
|
||||||
wait: true
|
|
||||||
services: ["pihole"]
|
|
||||||
register: _compose_result
|
|
||||||
@ -1,34 +0,0 @@
|
|||||||
---
|
|
||||||
services:
|
|
||||||
pihole:
|
|
||||||
image: pihole/pihole:{{ pihole.version }}
|
|
||||||
ports:
|
|
||||||
- "53:53/tcp"
|
|
||||||
- "53:53/udp"
|
|
||||||
- "67:67/udp"
|
|
||||||
environment:
|
|
||||||
TZ: 'Europe/Berlin'
|
|
||||||
FTLCONF_webserver_api_password: '{{ dns.api_key }}'
|
|
||||||
FTLCONF_dns_listeningMode: 'ALL' # recomendet for docker bridge
|
|
||||||
volumes:
|
|
||||||
- './data/pihole:/etc/pihole'
|
|
||||||
- './config/etc-dnsmasq.d:/etc/dnsmasq.d'
|
|
||||||
networks:
|
|
||||||
- exposed
|
|
||||||
cap_add:
|
|
||||||
- NET_ADMIN # For DHCP
|
|
||||||
restart: unless-stopped
|
|
||||||
labels:
|
|
||||||
traefik.enable: true
|
|
||||||
|
|
||||||
traefik.http.routers.pihole.entrypoints: https
|
|
||||||
traefik.http.routers.pihole.rule: Host(`{{ dns.domain }}`)
|
|
||||||
traefik.http.services.pihole.loadbalancer.server.port: 80
|
|
||||||
traefik.http.routers.pihole.tls: "true"
|
|
||||||
traefik.http.routers.pihole.tls.certresolver: hetzner
|
|
||||||
traefik.http.routers.pihole.middlewares: local-only@file
|
|
||||||
|
|
||||||
networks:
|
|
||||||
exposed:
|
|
||||||
name: traefik_exposed
|
|
||||||
external: true
|
|
||||||
@ -1 +0,0 @@
|
|||||||
dhcp-option=6,{{ ansible_facts.default_ipv4.address }}
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
{% for local_domain in dns.local_domains %}
|
|
||||||
address=/.{{ local_domain }}/{{ dns.domain_host | default(ansible_facts.default_ipv4.address, true) }}
|
|
||||||
address=/.{{ local_domain }}/{{ dns.domain_host_v6 | default(ansible_facts.default_ipv6.address, true) }}
|
|
||||||
|
|
||||||
{% endfor %}
|
|
||||||
@ -1 +0,0 @@
|
|||||||
# storage_mount
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
path: /srv/{{ role_name }}
|
|
||||||
|
|
||||||
storage_mount_override: {}
|
|
||||||
storage_mount_defaults:
|
|
||||||
type: "nfs4"
|
|
||||||
host: ""
|
|
||||||
host_path: ""
|
|
||||||
args: ""
|
|
||||||
dest_path: ""
|
|
||||||
user: ""
|
|
||||||
password: ""
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
- name: restart container
|
|
||||||
community.docker.docker_compose_v2:
|
|
||||||
project_src: "{{ path }}"
|
|
||||||
project_name: "{{ role_name }}"
|
|
||||||
recreate: "always"
|
|
||||||
services: ["storage_mount"]
|
|
||||||
state: "restarted"
|
|
||||||
when: not _storage_mount_already_restarted
|
|
||||||
@ -1,20 +0,0 @@
|
|||||||
---
|
|
||||||
galaxy_info:
|
|
||||||
author: "Niklas Freese <niklas@urmel.de>"
|
|
||||||
description: storage_mount
|
|
||||||
company: "Urmel Services"
|
|
||||||
license: AGPL-3.0-or-later
|
|
||||||
min_ansible_version: 2.1
|
|
||||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
|
||||||
# min_ansible_container_version:
|
|
||||||
|
|
||||||
galaxy_tags: []
|
|
||||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
|
||||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
|
||||||
# remove the '[]' above, if you add tags to this list.
|
|
||||||
#
|
|
||||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
|
||||||
# Maximum 20 tags per role.
|
|
||||||
|
|
||||||
dependencies:
|
|
||||||
- role: traefik
|
|
||||||
@ -1,41 +0,0 @@
|
|||||||
---
|
|
||||||
- name: "set local variables from overrides and defaults"
|
|
||||||
set_fact:
|
|
||||||
storage_mount: "{{ (storage_mount_defaults | combine(storage_mount_override, recursive=True)) if storage_mount_override else storage_mount_defaults }}"
|
|
||||||
|
|
||||||
- name: get final escaped name
|
|
||||||
command: "systemd-escape --suffix=mount --path {{ storage_mount.dest_path }}"
|
|
||||||
register: escaped_mount_path
|
|
||||||
|
|
||||||
- block:
|
|
||||||
- name: install nfs dependencies
|
|
||||||
package:
|
|
||||||
name:
|
|
||||||
- nfs-common
|
|
||||||
|
|
||||||
- name: template nsf.service
|
|
||||||
template:
|
|
||||||
src: nfs.service.j2
|
|
||||||
dest: "/etc/systemd/system/{{ escaped_mount_path.stdout }}"
|
|
||||||
when:
|
|
||||||
- "'nfs' in storage_mount.type"
|
|
||||||
|
|
||||||
- block:
|
|
||||||
- name: install cifs (for SMB) dependencies
|
|
||||||
package:
|
|
||||||
name:
|
|
||||||
- cifs-utils
|
|
||||||
|
|
||||||
- name: template smb.service
|
|
||||||
template:
|
|
||||||
src: smb.service.j2
|
|
||||||
dest: "/etc/systemd/system/{{ escaped_mount_path.stdout }}"
|
|
||||||
when:
|
|
||||||
- "'cifs' in storage_mount.type"
|
|
||||||
|
|
||||||
- name: Ensure systemd mountpoint is enabled+started
|
|
||||||
systemd_service:
|
|
||||||
state: "started"
|
|
||||||
daemon_reload: true
|
|
||||||
enabled: true
|
|
||||||
name: "{{ escaped_mount_path.stdout }}"
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=Mount {{ storage_mount.dest_path }} via NFS
|
|
||||||
After = network-online.target
|
|
||||||
Wants = network-online.target
|
|
||||||
|
|
||||||
[Mount]
|
|
||||||
What={{ storage_mount.host }}:{{ storage_mount.host_path }}
|
|
||||||
Where={{ storage_mount.dest_path }}
|
|
||||||
Type={{ storage_mount.type }}
|
|
||||||
Options={{ storage_mount.args }}
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=graphical.target
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=Mount {{ storage_mount.dest_path }} via SMB
|
|
||||||
After = network-online.target
|
|
||||||
Wants = network-online.target
|
|
||||||
|
|
||||||
[Mount]
|
|
||||||
What=//{{ storage_mount.host }}/{{ storage_mount.host_path }}
|
|
||||||
Where={{ storage_mount.dest_path }}
|
|
||||||
Type={{ storage_mount.type }}
|
|
||||||
Options={{ storage_mount.args }}
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=graphical.target
|
|
||||||
@ -1 +0,0 @@
|
|||||||
# wireguard
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
path: /srv/{{ role_name }}
|
|
||||||
|
|
||||||
wireguard_override: {}
|
|
||||||
wireguard_defaults:
|
|
||||||
version: "latest"
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
- name: restart container
|
|
||||||
community.docker.docker_compose_v2:
|
|
||||||
project_src: "{{ path }}"
|
|
||||||
project_name: "{{ role_name }}"
|
|
||||||
recreate: "always"
|
|
||||||
services: ["wireguard"]
|
|
||||||
state: "restarted"
|
|
||||||
when: not _wireguard_already_restarted
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
---
|
|
||||||
- name: "set local variables from overrides and defaults"
|
|
||||||
set_fact:
|
|
||||||
wireguard: "{{ (wireguard_defaults | combine(wireguard_override, recursive=True)) if wireguard_override else wireguard_defaults }}"
|
|
||||||
|
|
||||||
- name: ensure that path exists
|
|
||||||
file:
|
|
||||||
path: "{{ path }}/config"
|
|
||||||
state: directory
|
|
||||||
|
|
||||||
- name: template docker-compose
|
|
||||||
template:
|
|
||||||
src: compose.yml.j2
|
|
||||||
dest: "{{ path }}/compose.yml"
|
|
||||||
notify: restart container
|
|
||||||
|
|
||||||
- name: ensure container is running
|
|
||||||
community.docker.docker_compose_v2:
|
|
||||||
project_src: "{{ path }}"
|
|
||||||
project_name: "{{ role_name }}"
|
|
||||||
state: "present"
|
|
||||||
pull: "always"
|
|
||||||
wait: true
|
|
||||||
services: ["wireguard"]
|
|
||||||
register: _compose_result
|
|
||||||
@ -1,26 +0,0 @@
|
|||||||
---
|
|
||||||
services:
|
|
||||||
wireguard:
|
|
||||||
image: lscr.io/linuxserver/wireguard:{{ wireguard.version }}
|
|
||||||
container_name: wireguard
|
|
||||||
cap_add:
|
|
||||||
- NET_ADMIN
|
|
||||||
- SYS_MODULE
|
|
||||||
environment:
|
|
||||||
- PUID=1000
|
|
||||||
- PGID=1000
|
|
||||||
- TZ=Europe/Berlin
|
|
||||||
- SERVERURL=be.urmel.de
|
|
||||||
- SERVERPORT=51820
|
|
||||||
- PEERDNS=auto
|
|
||||||
- INTERNAL_SUBNET=10.100.1.0
|
|
||||||
- ALLOWEDIPS=0.0.0.0/0
|
|
||||||
- PERSISTENTKEEPALIVE_PEERS=30
|
|
||||||
- LOG_CONFS=true
|
|
||||||
volumes:
|
|
||||||
- ./config:/config
|
|
||||||
ports:
|
|
||||||
- 51820:51820/udp
|
|
||||||
sysctls:
|
|
||||||
- net.ipv4.conf.all.src_valid_mark=1
|
|
||||||
restart: unless-stopped
|
|
||||||
Loading…
x
Reference in New Issue
Block a user