1 class role::file_store (
2 Optional[Hash] $nfs_mounts = {},
3 Optional[String] $mountpoint = "/fichiers1",
5 include "base_installation"
7 include "profile::fstab"
8 include "profile::tools"
9 include "profile::monitoring"
10 include "profile::wireguard"
12 unless empty($mountpoint) {
14 server_enabled => true,
16 nfs_v4_export_root => '/exports',
17 nfs_v4_export_root_clients => 'localhost(rw)',
18 require => Mount[$mountpoint],
21 $nfs_mounts.each |$nfs_mount, $hosts| {
22 file { "$mountpoint/$nfs_mount":
23 ensure => "directory",
27 require => Mount[$mountpoint],
30 $hosts.each |$host_cn| {
31 $host = find_host($facts["ldapvar"]["other"], $host_cn)
33 fail("No host found for nfs")
34 } elsif has_key($host["vars"], "wireguard_ip") {
35 $clients = sprintf("%s%s",
36 join($host["vars"]["wireguard_ip"], "(rw,secure,sync,all_squash) "),
37 "(rw,secure,sync,all_squash)")
38 nfs::server::export { "$mountpoint/$nfs_mount":
44 } elsif has_key($host["vars"], "host") {
45 nfs::server::export { "$mountpoint/$nfs_mount":
49 clients => "${host[vars][host][0]}(rw,secure,sync,all_squash)",
52 nfs::server::export { "$mountpoint/$nfs_mount":
56 clients => "${host[vars][real_hostname][0]}(rw,secure,sync,all_squash)",