bundlewrap/bundles/homeassistant/items.py

73 lines
2 KiB
Python
Raw Permalink Normal View History

2022-12-22 16:36:26 +00:00
users = {
'homeassistant': {
'home': '/var/opt/homeassistant',
},
}
directories = {
2022-12-22 17:59:27 +00:00
'/opt/homeassistant': {
'owner': 'homeassistant',
},
2022-12-22 16:36:26 +00:00
'/var/opt/homeassistant': {
'owner': 'homeassistant',
},
}
files = {
'/etc/systemd/system/homeassistant.service': {
'triggers': {
'action:systemd-reload',
'svc_systemd:homeassistant:restart',
},
},
2022-12-24 16:51:42 +00:00
'/usr/local/share/icinga/plugins/check_homeassistant_update': {
'content_type': 'mako',
'context': {
'bearer': repo.vault.decrypt(node.metadata.get('homeassistant/api_secret')),
'domain': node.metadata.get('homeassistant/domain'),
},
'mode': '0755',
},
2022-12-22 16:36:26 +00:00
}
actions = {
'homeassistant_create_virtualenv': {
2022-12-22 17:59:27 +00:00
'command': 'sudo -u homeassistant /usr/bin/python3 -m virtualenv -p python3 /opt/homeassistant/venv/',
2022-12-22 16:36:26 +00:00
'unless': 'test -d /opt/homeassistant/venv/',
'needs': {
2022-12-22 17:59:27 +00:00
'directory:/opt/homeassistant',
'user:homeassistant',
},
},
'homeassistant_install': {
'command': 'sudo -u homeassistant /opt/homeassistant/venv/bin/pip install homeassistant',
'unless': 'test -f /opt/homeassistant/venv/bin/hass',
'needs': {
'action:homeassistant_create_virtualenv',
2022-12-22 16:36:26 +00:00
'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:libtiff6',
2022-12-22 16:36:26 +00:00
'pkg_apt:libturbojpeg0-dev',
'pkg_apt:tzdata',
},
'triggers': {
'svc_systemd:homeassistant:restart',
},
},
}
svc_systemd = {
'homeassistant': {
'needs': {
'action:homeassistant_install',
'file:/etc/systemd/system/homeassistant.service',
},
},
}