From 2274e7aa37ea4dba0cd045d8570e98b109834246 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Thu, 12 Nov 2020 19:59:02 +0100 Subject: [PATCH] bundles/nfs-server: introduce --- bundles/nfs-server/files/exports | 3 +++ bundles/nfs-server/items.py | 15 +++++++++++++++ bundles/nfs-server/metadata.py | 7 +++++++ nodes/home/nas.py | 8 ++++++++ 4 files changed, 33 insertions(+) create mode 100644 bundles/nfs-server/files/exports create mode 100644 bundles/nfs-server/items.py create mode 100644 bundles/nfs-server/metadata.py diff --git a/bundles/nfs-server/files/exports b/bundles/nfs-server/files/exports new file mode 100644 index 0000000..8241a51 --- /dev/null +++ b/bundles/nfs-server/files/exports @@ -0,0 +1,3 @@ +% for path, shares in node.metadata['nfs-server']['shares'].items(): +${path} ${' '.join(sorted(shares))} +% endfor diff --git a/bundles/nfs-server/items.py b/bundles/nfs-server/items.py new file mode 100644 index 0000000..692d2de --- /dev/null +++ b/bundles/nfs-server/items.py @@ -0,0 +1,15 @@ +files = { + '/etc/exports': { + 'content_type': 'mako', + 'triggers': { + 'action:nfs_reload_shares', + }, + }, +} + +actions = { + 'nfs_reload_shares': { + 'command': 'exportfs -a', + 'triggered': True, + }, +} diff --git a/bundles/nfs-server/metadata.py b/bundles/nfs-server/metadata.py new file mode 100644 index 0000000..64a4bcd --- /dev/null +++ b/bundles/nfs-server/metadata.py @@ -0,0 +1,7 @@ +defaults = { + 'apt': { + 'packages': { + 'nfs-kernel-server': {} + }, + }, +} diff --git a/nodes/home/nas.py b/nodes/home/nas.py index 2088360..58216c7 100644 --- a/nodes/home/nas.py +++ b/nodes/home/nas.py @@ -4,6 +4,7 @@ nodes['home.nas'] = { 'hostname': '172.19.138.90', 'bundles': { + 'nfs-server', 'zfs', }, 'groups': set(), @@ -21,6 +22,13 @@ nodes['home.nas'] = { 'gateway4': '172.19.138.1', }, }, + 'nfs-server': { + 'shares': { + '/storage/nas': { + '172.19.138.0/24(ro,all_squash,anonuid=65534,anongid=65534)', + }, + }, + }, 'systemd-networkd': { 'bonds': { 'bond0': {