diff --git a/bundles/nginx/items.py b/bundles/nginx/items.py index 509376f..045887b 100644 --- a/bundles/nginx/items.py +++ b/bundles/nginx/items.py @@ -44,9 +44,15 @@ files = { }, '/etc/nginx/sites-available': { 'delete': True, + 'needs': { + 'pkg_apt:nginx', + }, }, '/etc/nginx/sites-enabled': { 'delete': True, + 'needs': { + 'pkg_apt:nginx', + }, }, } diff --git a/bundles/openhab/items.py b/bundles/openhab/items.py index 0712ac1..0079c26 100644 --- a/bundles/openhab/items.py +++ b/bundles/openhab/items.py @@ -3,7 +3,18 @@ directories = { 'owner': 'openhab', 'group': 'openhab', 'needs': [ - 'zfs_dataset:tank/openhab', + 'zfs_dataset:tank/openhab/data', + 'pkg_apt:openhab', + ], + 'triggers': [ + 'svc_systemd:openhab:restart', + ], + }, + '/etc/openhab': { + 'owner': 'openhab', + 'group': 'openhab', + 'needs': [ + 'zfs_dataset:tank/openhab/config', 'pkg_apt:openhab', ], 'triggers': [ @@ -18,6 +29,8 @@ svc_systemd = { 'needs': [ 'pkg_apt:openhab', 'directory:/var/lib/openhab', + 'zfs_dataset:tank/openhab/config', + 'zfs_dataset:tank/openhab/data', ], } } diff --git a/bundles/openhab/metadata.py b/bundles/openhab/metadata.py index 60b1795..ff45932 100644 --- a/bundles/openhab/metadata.py +++ b/bundles/openhab/metadata.py @@ -3,7 +3,8 @@ defaults = { 'packages': { 'openhab': { 'needs': [ - 'zfs_dataset:tank/openhab', + 'zfs_dataset:tank/openhab/config', + 'zfs_dataset:tank/openhab/data', ], }, }, @@ -14,6 +15,12 @@ defaults = { 'zfs': { 'datasets': { 'tank/openhab': { + 'mountpoint': 'none', + }, + 'tank/openhab/config': { + 'mountpoint': '/etc/openhab', + }, + 'tank/openhab/data': { 'mountpoint': '/var/lib/openhab', }, }, diff --git a/bundles/zfs/items.py b/bundles/zfs/items.py index 8d74a6f..d075481 100644 --- a/bundles/zfs/items.py +++ b/bundles/zfs/items.py @@ -8,6 +8,12 @@ files = { '/etc/cron.daily/zfs-auto-snapshot': {'delete': True}, '/etc/cron.weekly/zfs-auto-snapshot': {'delete': True}, '/etc/cron.monthly/zfs-auto-snapshot': {'delete': True}, + '/etc/modprobe.d/zfs.conf': { + 'content': '\n'.join( + f'option zfs {k}={v}' + for k, v in node.metadata.get('zfs/kernel_params').items() + ) + '\n', + }, } actions = { diff --git a/bundles/zfs/metadata.py b/bundles/zfs/metadata.py index ded24f9..e113379 100644 --- a/bundles/zfs/metadata.py +++ b/bundles/zfs/metadata.py @@ -77,6 +77,7 @@ defaults = { 'zfs': { 'datasets': {}, 'pools': {}, + 'kernel_params': {}, }, } diff --git a/groups/hardware/raspberry-pi.py b/groups/hardware/raspberry-pi.py index 38c140e..93b1390 100644 --- a/groups/hardware/raspberry-pi.py +++ b/groups/hardware/raspberry-pi.py @@ -15,5 +15,10 @@ 'grafana_rows': { 'health', }, + 'zfs': { + 'kernel_params': { + 'zfs_txg_timeout': 300, + }, + }, }, } diff --git a/nodes/home.homematic.py b/nodes/home.homematic.py index e36ff0f..3e436f1 100644 --- a/nodes/home.homematic.py +++ b/nodes/home.homematic.py @@ -7,5 +7,10 @@ 'ipv4': '10.0.2.8/24', }, }, + 'dns': { + 'homematic.ckn.li': { + 'A': {'10.0.2.8'}, + }, + }, }, } diff --git a/nodes/home.openhab.py b/nodes/home.openhab.py index c319960..e339ad3 100644 --- a/nodes/home.openhab.py +++ b/nodes/home.openhab.py @@ -1,19 +1,55 @@ { - 'hostname': '10.0.0.14', + 'hostname': '10.0.0.17', 'groups': [ 'raspberry-pi', - 'debian-10', + 'debian-11', + 'monitored', + 'webserver', ], 'bundles': [ + 'zfs', + 'openhab', + 'java', ], 'metadata': { - 'id': '397d6f7f-f5bb-49ab-bdad-f1404e49d0d5', + 'FIXME_dont_touch_sshd': True, + 'telegraf': { + 'config': { + 'agent': { + 'flush_interval': '30s', + 'interval': '30s', + }, + }, + }, + 'id': '0afcde75-95c8-4fbd-b4c2-8a0fcc92884a', 'network': { 'internal': { 'interface': 'eth0', - 'ipv4': '10.0.0.14/24', + 'ipv4': '10.0.0.17/24', 'gateway4': '10.0.0.1', }, }, + 'nginx': { + 'vhosts': { + 'openhab.ckn.li': { + 'content': 'nginx/proxy_pass.conf', + 'context': { + 'target': 'http://localhost:8080', + }, + }, + }, + }, + 'java': { + 'version': 11, + }, + 'zfs': { + 'pools': { + 'tank': { + 'devices': [ + '/dev/sda', + ], + }, + }, + }, }, } diff --git a/nodes/home.openhab3.py b/nodes/home.openhab3.py deleted file mode 100644 index 46ed10c..0000000 --- a/nodes/home.openhab3.py +++ /dev/null @@ -1,56 +0,0 @@ -{ - 'hostname': '10.0.0.17', - 'groups': [ - 'raspberry-pi', - 'debian-11', - 'monitored', - 'webserver', - ], - 'bundles': [ - 'zfs', - 'openhab', - 'java', - 'mirror', - ], - 'metadata': { - 'FIXME_dont_touch_sshd': True, - 'telegraf': { - 'config': { - 'agent': { - 'flush_interval': '30s', - 'interval': '30s', - }, - }, - }, - 'id': '0afcde75-95c8-4fbd-b4c2-8a0fcc92884a', - 'network': { - 'internal': { - 'interface': 'eth0', - 'ipv4': '10.0.0.17/24', - 'gateway4': '10.0.0.1', - }, - }, - 'nginx': { - 'vhosts': { - 'openhab.ckn.li': { - 'content': 'nginx/proxy_pass.conf', - 'context': { - 'target': 'http://localhost:8080', - }, - }, - }, - }, - 'java': { - 'version': 11, - }, - 'zfs': { - 'pools': { - 'tank': { - 'devices': [ - '/dev/disk/by-id/mmc-SE32G_0x1766be0d-part3', - ], - }, - }, - }, - }, -} diff --git a/nodes/htz.mails.py b/nodes/htz.mails.py index cb825e8..5e0daa2 100644 --- a/nodes/htz.mails.py +++ b/nodes/htz.mails.py @@ -130,17 +130,6 @@ 'version': '1.5-rc', 'installer': True, }, - 'users': { - 'root': { - 'authorized_users': { - 'root@home.server', - 'root@home.openhab3', - }, - 'authorized_keys': { - 'ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBHMKTJLw6Cb+MLt+9JFOkuo2QBpuA8EoTKOFpb3IFQHEq19YLMzOhcErWmzaRfiCnILhnwTQz0njS+n9Qu4aghk= root@mail.sublimity.de' - }, - }, - }, 'vm': { 'cores': 2, 'ram': 8096,