From 107fd6872be8cf6b48a9f746163e82f866d536e7 Mon Sep 17 00:00:00 2001 From: Sophie Schiller Date: Thu, 22 Dec 2022 17:53:10 +0100 Subject: [PATCH] home.hass add metadata --- bundles/homeassistant/metadata.py | 41 +++++++++++++++++++++++++++++++ nodes/home.hass.toml | 18 +++++++++++++- 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/bundles/homeassistant/metadata.py b/bundles/homeassistant/metadata.py index 3f66d4d..6c71656 100644 --- a/bundles/homeassistant/metadata.py +++ b/bundles/homeassistant/metadata.py @@ -21,3 +21,44 @@ defaults = { }, }, } +@metadata_reactor.provides( + 'icinga2_api/homeassistant/services/HOMESSISTANT UPDATE', +) +def icinga_check_for_new_release(metadata): + return { + 'icinga2_api': { + 'homeassistant': { + 'services': { + 'HOMEASSISTANT UPDATE': { + 'command_on_monitored_host': '/usr/local/share/icinga/plugins/check_github_for_new_release homeassistant/core {}'.format(metadata.get('homeassistant/version')), + 'vars.notification.mail': True, + 'check_interval': '60m', + }, + }, + }, + }, + } + +@metadata_reactor.provides( + 'nginx/vhosts/homeassistant', +) +def nginx(metadata): + if not node.has_bundle('nginx'): + raise DoNotRunAgain + + return { + 'nginx': { + 'vhosts': { + 'homeassistant': { + 'domain': metadata.get('homeassistant/domain'), + 'website_check_path': '/', + 'website_check_string': 'Homeassistant', + 'locations': { + '/': { + 'target': 'http://127.0.0.1:8123', + }, + }, + }, + }, + }, + } diff --git a/nodes/home.hass.toml b/nodes/home.hass.toml index 34cf68d..a053f8c 100644 --- a/nodes/home.hass.toml +++ b/nodes/home.hass.toml @@ -1,5 +1,8 @@ hostname = "172.19.138.25" -bundles = [] +bundles = [ + 'homeassistant', + 'nginx' +] groups = ["debian-bullseye"] [metadata.backups] @@ -13,3 +16,16 @@ ipv6_accept_ra = true [metadata.vm] cpu = 2 ram = 2 + +[metadata.homeassistant] +domain = 'hass.home.kunbox.net' +version = '2022.12.8' + +[metadata.nginx] +restrict-to = [ + '172.19.136.0/25', + '172.19.138.0/24', +] + +[metadata.nginx.vhosts.homeassistant] +ssl = '_.home.kunbox.net'