Puppet Class: profile::dumps::nfs_client
- Defined in:
- modules/profile/manifests/dumps/nfs_client.pp
Overview
SPDX-License-Identifier: Apache-2.0
Class profile::dumps::nfs_client
Mounts dumps read-only over NFS
Parameters:
$ensure: Whether the mount and associated resources should be present (default: 'present').
$server: The NFS server hostname to mount (default: 'dumps-nfs.wikimedia.org').
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'modules/profile/manifests/dumps/nfs_client.pp', line 10
class profile::dumps::nfs_client (
Wmflib::Ensure $ensure = lookup('profile::dumps::nfs_client::ensure', {default_value => present }),
Stdlib::Host $server = lookup('profile::dumps::nfs_client::server', {default_value => 'dumps-nfs.wikimedia.org' }),
) {
stdlib::ensure_packages(['nfs-common'])
if !defined(File['/mnt/nfs']) {
file { '/mnt/nfs':
ensure => directory,
}
}
# TODO deploy 'dumpsgen' (uid/gid 400) to both cloudvps and prod
file { '/mnt/nfs/dumps':
ensure => directory,
owner => 400,
group => 400,
force => true,
}
# lookupcache=all: trust the attribute/cache lookup results unconditionally; avoids extra stat round-trips on read-only mounts
# nofsc: disable NFSv4 state management (locks, delegations, open state); appropriate for read-only, no-contention workloads
$nfs_options = ['ro', 'bg', 'soft', 'tcp', 'noatime', 'lookupcache=all', 'nofsc']
$retry_options = ['timeo=20', 'retrans=1']
$systemd_options = ['x-systemd.automount', 'x-systemd.idle-timeout=60', 'x-systemd.mount-timeout=3']
# nofail: don't fail boot if the NFS server is unreachable
# _netdev: delay mounting until the network is available
$network_options = ['nofail', '_netdev']
mount { '/mnt/nfs/dumps':
ensure => $ensure,
device => "${server}:/",
fstype => 'nfs',
options => join([$nfs_options, $retry_options, $systemd_options, $network_options], ','),
atboot => true,
require => File['/mnt/nfs/'],
}
service { 'mnt-nfs-dumps.automount':
ensure => stdlib::ensure($ensure, 'service'),
}
# The sitter checks the mountpoint for ESTALE errors, and issues umount -l
file { '/usr/local/bin/dumps-nfs-client-sitter':
ensure => stdlib::ensure($ensure, 'file'),
mode => '0755',
source => 'puppet:///modules/profile/dumps/nfs_client/sitter.py',
}
systemd::service { 'dumps-nfs-client-sitter':
ensure => $ensure,
content => template('profile/dumps/nfs_client/sitter.service.erb'),
require => File['/usr/local/bin/dumps-nfs-client-sitter'],
subscribe => File['/usr/local/bin/dumps-nfs-client-sitter'],
}
}
|