]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/blame - modules/role/manifests/file_store.pp
Group hosts in single export line
[perso/Immae/Projets/Puppet.git] / modules / role / manifests / file_store.pp
CommitLineData
81ec6f92 1class role::file_store (
7d8c507f 2 Optional[Hash] $nfs_mounts = {},
81ec6f92
IB
3 Optional[String] $mountpoint = "/fichiers1",
4) {
5 include "base_installation"
6
7 include "profile::fstab"
8 include "profile::tools"
9 include "profile::monitoring"
7f8c6327 10 include "profile::wireguard"
81ec6f92
IB
11
12 unless empty($mountpoint) {
13 class { "::nfs":
14 server_enabled => true,
15 nfs_v4 => true,
16 nfs_v4_export_root => '/exports',
17 nfs_v4_export_root_clients => 'localhost(rw)',
18 require => Mount[$mountpoint],
19 }
20
7d8c507f 21 $nfs_mounts.each |$nfs_mount, $hosts| {
81ec6f92
IB
22 file { "$mountpoint/$nfs_mount":
23 ensure => "directory",
24 mode => "0755",
25 owner => "nobody",
26 group => "nobody",
27 require => Mount[$mountpoint],
7d8c507f 28 }
da476aeb
IB
29 ->
30 nfs::server::export { "$mountpoint/$nfs_mount":
31 owner => "nobody",
32 group => "nobody",
33 ensure => "present",
34 clients => template("role/file_store/nfs_clients.erb"),
81ec6f92
IB
35 }
36 }
37 }
38}