blind dev result of homeassistant

This commit is contained in:
Sophie Schiller 2022-12-22 17:36:26 +01:00
parent fcb546baf6
commit c407a4520a
3 changed files with 102 additions and 0 deletions

View file

@ -0,0 +1,13 @@
[Unit]
Description=Home Assistant
After=network-online.target
[Service]
Type=simple
User=homeassistant
WorkingDirectory=/var/opt/homeassistant
ExecStart=/opt/homeassistant/bin/hass -c "/var/opt/homeassistant"
RestartForceExitStatus=100
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,66 @@
users = {
'homeassistant': {
'home': '/var/opt/homeassistant',
},
}
directories = {
'/opt/homeassistant': {},
'/var/opt/homeassistant': {
'owner': 'homeassistant',
},
}
files = {
'/etc/systemd/system/homeassistant.service': {
'triggers': {
'action:systemd-reload',
'svc_systemd:homeassistant:restart',
},
},
}
actions = {
'homeassistant_create_virtualenv': {
'command': '/usr/bin/python3 -m virtualenv -p python3 /opt/homeassistant/venv',
'unless': 'test -d /opt/homeassistant/venv/',
'needed_by': {
'action:homeassistant_install',
},
},
'homeassistant_install': {
'triggered': True,
'command': ' && '.join([
'cd /opt/homeassistant/src',
f"/opt/homeassistant/venv/bin/pip install --upgrade homeassistant=={node.metadata.get('homeassistant/version')}",
]) ,
'needs': {
'pkg_apt:bluez',
'pkg_apt:libffi-dev',
'pkg_apt:libssl-dev',
'pkg_apt:libjpeg-dev',
'pkg_apt:zlib1g-dev',
'pkg_apt:autoconf',
'pkg_apt:build-essential',
'pkg_apt:libopenjp2-7',
'pkg_apt:libtiff5',
'pkg_apt:libturbojpeg0-dev',
'pkg_apt:tzdata',
},
'triggers': {
'svc_systemd:homeassistant:restart',
},
'unless': {
"[[ $(/opt/homeassistant/venv/bin/pip freeze | grep homeassistant=={node.metadata.get('homeassistant/version')}) ]]",
},
},
}
svc_systemd = {
'homeassistant': {
'needs': {
'action:homeassistant_install',
'file:/etc/systemd/system/homeassistant.service',
},
},
}

View file

@ -0,0 +1,23 @@
defaults = {
'apt': {
'packages': {
'bluez': {},
'libffi-dev': {},
'libssl-dev': {},
'libjpeg-dev': {},
'zlib1g-dev': {},
'autoconf': {},
'build-essential': {},
'libopenjp2-7': {},
'libtiff5': {},
'libturbojpeg0-dev': {},
'tzdata': {},
},
},
'backups': {
'paths': {
'/opt/homeassistant',
'/var/opt/homeassistant',
},
},
}