Puppet Class: nfs::client::config

Defined in:
manifests/client/config.pp

Summary

Overview

Class: nfs::client::config This Function exists to

1. configure nfs as a client

Author:



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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'manifests/client/config.pp', line 10

class nfs::client::config {
  if $nfs::client::nfs_v4 {
    if $nfs::defaults_file != undef {
      if $nfs::client_gssd_options != '' {
        $_gssd1_aug = ["set ${nfs::client_gssdopt_name} \"'${nfs::client_gssd_options}'\""]
      } else {
        $_gssd1_aug = undef
      }

      if $nfs::client_need_gssd {
        $_gssd2_aug = ['set NEED_GSSD yes']
      } else {
        $_gssd2_aug = undef
      }

      augeas { $nfs::defaults_file:
        context => "/files/${nfs::defaults_file}",
        changes => delete_undef_values(concat($nfs::client_idmapd_setting, $_gssd1_aug, $_gssd2_aug)),
      }
    }

    if ($nfs::client_rpcbind_config != undef) and ($nfs::client_rpcbind_optname != undef) and ($nfs::client_rpcbind_opts != undef) {
      augeas { $nfs::client_rpcbind_config:
        incl    => $nfs::client_rpcbind_config,
        lens    => 'Shellvars.lns',
        context => "/files/${nfs::client_rpcbind_config}",
        changes => "set ${nfs::client_rpcbind_optname} \"'${nfs::client_rpcbind_opts}'\"",
      }
    }

    if $nfs::client_d9_gssdopt_workaround and $nfs::client_gssd_service {
      file_line { 'rpc-gssd.service':
        path  => '/lib/systemd/system/rpc-gssd.service',
        match => 'EnvironmentFile',
        line  => 'EnvironmentFile=-/etc/default/nfs-common',
      }
      exec { 'systemctl daemon-reload':
        refreshonly => true,
        path        => '/bin',
      }
      Package['nfs-common']
      -> File_line['rpc-gssd.service']
      ~> Exec['systemctl daemon-reload']
      ~> Service['rpc-gssd']
    }

    if ( $nfs::server_enabled == false ) or ( $nfs::server_enabled == true and $nfs::nfs_v4 == false ) {
      if $nfs::idmapd_file != undef {
        if $nfs::nfs_v4_idmap_localrealms != '' {
          if $nfs::nfs_v4_idmap_localrealms =~ String {
            $_localrealms = $nfs::nfs_v4_idmap_localrealms
          } else {
            $_localrealms = join($nfs::nfs_v4_idmap_localrealms, ',')
          }
          $_aug_localrealm = "set General/Local-Realms ${_localrealms}"
        } else {
          $_aug_localrealm = undef
        }

        if $nfs::nfs_v4_idmap_cache != 0 {
          $_cache = "set General/Cache-Expiration ${nfs::nfs_v4_idmap_cache}"
        } else {
          $_cache = undef
        }

        if $nfs::manage_nfs_v4_idmap_nobody_mapping {
          $_user = "set Mapping/Nobody-User ${nfs::nfs_v4_idmap_nobody_user}"
          $_group = "set Mapping/Nobody-Group ${nfs::nfs_v4_idmap_nobody_group}"
        } else {
          $_user = undef
          $_group = undef
        }

        $changes = ["set General/Domain ${nfs::nfs_v4_idmap_domain}", $_aug_localrealm, $_cache, $_user, $_group]
        $filtered_changes = filter($changes) |$val| { $val =~ NotUndef }

        augeas { $nfs::idmapd_file:
          context => "/files/${nfs::idmapd_file}",
          lens    => 'Puppet.lns',
          incl    => $nfs::idmapd_file,
          changes => $filtered_changes,
        }
      }
    }
  }
}