Compare commits

...

3 commits

Author SHA1 Message Date
301889ab8b
homeassistant kinda works 2024-05-31 15:14:49 +02:00
1a163ce9f0
dep order 2024-05-31 15:14:16 +02:00
15a78737cb
sort 2024-05-31 15:13:37 +02:00
6 changed files with 149 additions and 18 deletions

View file

@ -1,20 +1,37 @@
users = {
'homeassistant': {
'home': '/var/lib/homeassistant',
'home': '/opt/homeassistant',
'groups': [
'dialout',
#'gpio',
#'i2c',
],
},
}
directories = {
'/var/lib/homeassistant': {
'/opt/homeassistant': {
'owner': 'homeassistant',
'group': 'homeassistant',
},
'/var/lib/homeassistant/config': {
'/opt/homeassistant/data': {
'owner': 'homeassistant',
'group': 'homeassistant',
},
'/var/lib/homeassistant/venv': {
'/opt/homeassistant/venv': {
'owner': 'homeassistant',
'group': 'homeassistant',
},
}
svc_systemd = {
'homeassistant.service': {},
}
# https://wiki.instar.com/de/Software/Linux/Home_Assistant/
# venv manually managed for now
'''
python3 -m venv /opt/homeassistant/venv
source /opt/homeassistant/venv/bin/activate
python3 -m pip install wheel
pip3 install homeassistant
'''

View file

@ -12,9 +12,62 @@ defaults = {
'autoconf': {},
'build-essential': {},
'libopenjp2-7': {},
'libtiff5': {},
'libturbojpeg0-dev': {},
'tzdata': {},
#'bluez': {},
'libtiff6': {},
'ffmpeg': {},
'liblapack3': {},
'liblapack-dev': {},
'libatlas-base-dev': {},
'libpcap-dev': {},
},
},
'systemd': {
'units': {
f'homeassistant.service': {
'Unit': {
'Description': "Home Assstant",
'After': 'network.target',
},
'Service': {
'User': 'homeassistant',
'Group': 'homeassistant',
'WorkingDirectory': "/opt/homeassistant",
'ExecStart': "/opt/homeassistant/venv/bin/python3 /opt/homeassistant/venv/bin/hass -c /opt/homeassistant/data",
},
'Install': {
'WantedBy': {
'multi-user.target'
},
},
}
},
},
'zfs': {
'datasets': {
'tank/homeassistant': {
'mountpoint': '/opt/homeassistant/data',
'needed_by': {
'user:homeassistant',
'directory:/opt/homeassistant',
},
},
},
},
}
@metadata_reactor.provides(
'nginx/vhosts',
)
def nginx(metadata):
return {
'nginx': {
'vhosts': {
metadata.get('homeassistant/domain'): {
'content': 'homeassistant/vhost.conf',
},
},
},
}

View file

@ -20,18 +20,19 @@ files = {
}
actions = {
'systemd-locale': {
'command': f'localectl set-locale LANG="{default_locale}"',
'unless': f'localectl | grep -Fi "system locale" | grep -Fi "{default_locale}"',
'triggers': {
'action:locale-gen',
},
},
'locale-gen': {
'command': 'locale-gen',
'triggered': True,
'needs': {
'pkg_apt:locales',
},
},
'systemd-locale': {
'command': f'localectl set-locale LANG="{default_locale}"',
'unless': f'localectl | grep -Fi "system locale" | grep -Fi "{default_locale}"',
'preceded_by': {
'action:locale-gen',
'action:systemd-locale',
},
},
}

View file

@ -0,0 +1,21 @@
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name ${server_name};
ssl_certificate /var/lib/dehydrated/certs/${server_name}/fullchain.pem;
ssl_certificate_key /var/lib/dehydrated/certs/${server_name}/privkey.pem;
location / {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:8123;
}
}

View file

@ -0,0 +1,39 @@
{
'hostname': '10.0.0.16',
'groups': [
'autologin',
'backup',
'debian-12',
'hardware',
'home',
'monitored',
'raspberry-pi',
'webserver',
],
'bundles': [
'homeassistant',
'zfs',
],
'metadata': {
'id': '3d67964d-1270-4d3c-b93f-9c44219b3d59',
'network': {
'internal': {
'interface': 'eth0',
'ipv4': '10.0.0.16/24',
'gateway4': '10.0.0.1',
},
},
'homeassistant': {
'domain': 'homeassistant.ckn.li',
},
'zfs': {
'pools': {
'tank': {
'devices': [
'/var/lib/zfs/tank.img',
],
},
},
},
},
}

View file

@ -21,11 +21,6 @@
'zfs',
],
'metadata': {
'wordpress': {
'elimukwanza': {
'domain': 'elimu-kwanza.de',
},
},
'id': 'ea29bdf0-0b47-4bf4-8346-67d60c9dc4ae',
'network': {
'internal': {
@ -84,6 +79,11 @@
'download-server': {
'hostname': 'dl.sublimity.de',
},
'wordpress': {
'elimukwanza': {
'domain': 'elimu-kwanza.de',
},
},
'left4dead2': {
'servers': {
'standard': {