Skip to content

Commit

Permalink
Merge pull request #254 from ComputeCanada/nfs_automount
Browse files Browse the repository at this point in the history
Automount nfs exports on client on access instead of having puppet try to mount them
  • Loading branch information
cmd-ntrf authored Aug 28, 2023
2 parents 9dc1712 + 702953d commit 4b48f1a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion site/profile/manifests/nfs.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,24 @@
$devices = lookup('profile::nfs::server::devices', undef, undef, {})
if $devices =~ Hash[String, Array[String]] {
$nfs_export_list = keys($devices)
$options_nfsv4 = 'proto=tcp,nosuid,nolock,noatime,actimeo=3,nfsvers=4.2,seclabel,bg'
$options_nfsv4 = 'proto=tcp,nosuid,nolock,noatime,actimeo=3,nfsvers=4.2,seclabel,x-systemd.automount,x-systemd.mount-timeout=30,_netdev'
$nfs_export_list.each | String $name | {
nfs::client::mount { "/${name}":
ensure => present,
server => $server_ip,
share => $name,
options_nfsv4 => $options_nfsv4,
notify => Systemd::Daemon_reload['nfs-automount'],
}
}
}

ensure_resource('systemd::daemon_reload', 'nfs-automount')
exec { 'systemctl restart remote-fs.target':
subscribe => Systemd::Daemon_reload['nfs-automount'],
refreshonly => true,
path => ['/bin', '/usr/bin'],
}
}

class profile::nfs::server (
Expand Down

0 comments on commit 4b48f1a

Please sign in to comment.