Puppet Class: nfs::client::service

Defined in:
manifests/client/service.pp

Summary

Manage NFS client-specific services

Overview



6
7
8
9
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
66
67
68
69
70
# File 'manifests/client/service.pp', line 6

class nfs::client::service
{

  assert_private()

  service { 'nfs-client.target':
    ensure     => 'running',
    enable     => true,
    # To ensure we pick up config changes and have dependent unit ordering
    # correct, restart nfs-utils and nfs-client at the same time. Serially
    # restarting these does not reliably work.
    hasrestart => false,
    restart    => '/usr/bin/systemctl restart nfs-utils.service nfs-client.target',
    before     => [
      Sysctl['sunrpc.tcp_slot_table_entries'],
      Sysctl['sunrpc.udp_slot_table_entries'],
      Sysctl['fs.nfs.nfs_callback_tcpport']
    ]
  }

  # Dynamically tune with the proper number of sunrpc slot entries.
  # Although these parameters will be loaded on boot because of entries in
  # /etc/modprobe.d/sunrpc.conf created by nfs::base::config, this will ensure
  # the settings are picked up sooner if the sunrpc kernel module was already
  # loaded when this manifest is applied.
  ensure_resource('sysctl', 'sunrpc.tcp_slot_table_entries', {
    ensure  => 'present',
    val     => $nfs::sunrpc_tcp_slot_table_entries,
    # Ignore failure if var-lib-nfs-rpc_pipefs.mount was not up
    # when the sysctl values were cached by the sysctl resource.
    silent  => true,
    comment => 'Managed by simp-nfs Puppet module'
  } )

  ensure_resource('sysctl', 'sunrpc.udp_slot_table_entries', {
    ensure  => 'present',
    val     => $nfs::sunrpc_udp_slot_table_entries,
    # Ignore failure if var-lib-nfs-rpc_pipefs.mount was not up
    # when the sysctl values were cached by the sysctl resource.
    silent  => true,
    comment => 'Managed by simp-nfs Puppet module'
  } )

  # Dynamically tune the client callback port.
  # Although this parameter will be loaded on boot because of an entry in
  # /etc/modprobe.d/nfs.conf created by nfs::client::config, this will ensure
  # the setting is picked up sooner if the nfsv4 kernel module was already
  # loaded when this manifest is applied.
  sysctl { 'fs.nfs.nfs_callback_tcpport':
    ensure  => 'present',
    val     => $nfs::client::callback_port,
    # Ignore failure if nfsv4 module was not loaded when the sysctl
    # values were cached by the sysctl resource.
    silent  => true,
    comment => 'Managed by simp-nfs Puppet module'
  }

  if $nfs::client::blkmap {
    service { 'nfs-blkmap.service':
      ensure     => 'running',
      enable     => true,
      hasrestart => true
    }
  }
}