From 5a4c3284b65a2cf90d721352afcea299e0ba27e5 Mon Sep 17 00:00:00 2001 From: Sophie Schiller Date: Thu, 3 Apr 2025 20:08:25 +0200 Subject: [PATCH] sophie/vmhost: new disksgit add sophie/vmhost.py git add sophie/vmhost.py --- nodes/sophie/vmhost.py | 56 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/nodes/sophie/vmhost.py b/nodes/sophie/vmhost.py index d6e56f3..3fa02ec 100644 --- a/nodes/sophie/vmhost.py +++ b/nodes/sophie/vmhost.py @@ -3,6 +3,7 @@ nodes['sophie.vmhost'] = { 'bundles': { 'backup-client', 'lm-sensors', + 'nfs-server', 'mosquitto', 'smartd', 'vmhost', @@ -12,6 +13,9 @@ nodes['sophie.vmhost'] = { 'debian-bookworm', }, 'metadata': { + 'groups': { + 'nas': {}, + }, 'interfaces': { 'br1': { 'ips': { @@ -49,11 +53,27 @@ nodes['sophie.vmhost'] = { '172.19.164.0/24', }, }, + 'nfs-server': { + 'shares': { + '/srv/nas': { + '172.19.164.0/24': 'ro,all_squash,anonuid=65534,anongid=65534,no_subtree_check', + }, + }, + }, + 'smartd': { + 'disks': { + '/dev/nvme0', + + # nas disks + '/dev/disk/by-id/ata-ST20000NM007D-3DJ103_ZVT7BHBQ', + '/dev/disk/by-id/ata-ST20000NM007D-3DJ103_ZVT7D6JP', + }, + }, 'systemd-networkd': { 'bridges': { 'br0': { 'match': { - 'eno1', + 'enp1s0', }, }, 'br1': { @@ -63,6 +83,26 @@ nodes['sophie.vmhost'] = { }, }, }, + 'systemd-timers': { + 'timers': { + # Ensure every user is able to read and write to the NAS dataset. + 'nas_permissions': { + 'command': [ + 'chown -R :nas /srv/nas/', + r'find /srv/nas/ -type d -exec chmod 0775 {} \;', + r'find /srv/nas/ -type f -exec chmod 0664 {} \;', + ], + 'when': '*-*-* 02:00:00', + }, + }, + }, + 'users': { + 'sophie': { + 'groups': { + 'nas', + }, + }, + }, 'zfs': { 'pools': { 'storage': { @@ -73,12 +113,26 @@ nodes['sophie.vmhost'] = { }, }] } + }, + 'nas': { + 'when_creating': { + 'config': [{ + 'type': 'mirror', + 'devices': { + '/dev/disk/by-id/ata-ST20000NM007D-3DJ103_ZVT7BHBQ', + '/dev/disk/by-id/ata-ST20000NM007D-3DJ103_ZVT7D6JP', + }, + }] + } } }, "datasets": { "storage/libvirt": { "mountpoint": "/var/lib/libvirt", }, + "nas": { + "mountpoint": "/srv/nas", + }, }, }, },