From da476aeb6d365769de4956796b25255086d94cb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= <ismael.bouya@normalesup.org> Date: Sat, 18 Aug 2018 19:45:20 +0200 Subject: Group hosts in single export line --- modules/role/manifests/file_store.pp | 36 ++++++------------------------------ 1 file changed, 6 insertions(+), 30 deletions(-) (limited to 'modules/role/manifests') diff --git a/modules/role/manifests/file_store.pp b/modules/role/manifests/file_store.pp index d1f6a67..665a32b 100644 --- a/modules/role/manifests/file_store.pp +++ b/modules/role/manifests/file_store.pp @@ -26,36 +26,12 @@ class role::file_store ( group => "nobody", require => Mount[$mountpoint], } - - $hosts.each |$host_cn| { - $host = find_host($facts["ldapvar"]["other"], $host_cn) - if empty($host) { - fail("No host found for nfs") - } elsif has_key($host["vars"], "wireguard_ip") { - $clients = sprintf("%s%s", - join($host["vars"]["wireguard_ip"], "(rw,secure,sync,all_squash) "), - "(rw,secure,sync,all_squash)") - nfs::server::export { "$mountpoint/$nfs_mount": - owner => "nobody", - group => "nobody", - ensure => "present", - clients => $clients, - } - } elsif has_key($host["vars"], "host") { - nfs::server::export { "$mountpoint/$nfs_mount": - owner => "nobody", - group => "nobody", - ensure => "present", - clients => "${host[vars][host][0]}(rw,secure,sync,all_squash)", - } - } else { - nfs::server::export { "$mountpoint/$nfs_mount": - owner => "nobody", - group => "nobody", - ensure => "present", - clients => "${host[vars][real_hostname][0]}(rw,secure,sync,all_squash)", - } - } + -> + nfs::server::export { "$mountpoint/$nfs_mount": + owner => "nobody", + group => "nobody", + ensure => "present", + clients => template("role/file_store/nfs_clients.erb"), } } } -- cgit v1.2.3