Puppet Class: name_service_switch
- Inherits:
- name_service_switch::params
- Defined in:
- manifests/init.pp
Overview
Name_service_switch
Manage the name service switch - Manage the name service switch -
/etc/nsswitch.conf
on Linux and Solaris,
/etc/netsvc.conf
on AIX
The different supported platforms have different ways of assigning values
in their respective configuration files. For example, solaris uses:
:\tVALUE
Whereas AIX uses: =
In the examples
above, up-to three characters are used to delimit a key vs a value. Taking
AIX, ldelim is , delim is
and rdelim is “.
The module largely takes care of these idiosyncrasies itself, however, you may override via parameters if necessary
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 |
# File 'manifests/init.pp', line 28
class name_service_switch(
String $nss_owner = $name_service_switch::params::nss_owner,
String $nss_path = $name_service_switch::params::nss_path,
String $nss_group = $name_service_switch::params::nss_group,
String $nss_mode = $name_service_switch::params::nss_mode,
String $ldelim = $name_service_switch::params::ldelim,
String $delim = $name_service_switch::params::delim,
String $rdelim = $name_service_switch::params::rdelim,
Hash[String,String] $entries = $name_service_switch::params::entries,
) inherits name_service_switch::params {
file { $nss_path:
ensure => file,
owner => $nss_owner,
group => $nss_group,
mode => $nss_mode,
}
$ldelim_re = $ldelim ? {
"" => "",
default => "${ldelim}*",
}
$entries.each |$key, $value| {
file_line { "${nss_path} ${key}":
ensure => present,
path => $nss_path,
line => "${key}${ldelim}${delim}${rdelim}${value}",
match => "^${key}${ldelim_re}${delim}",
}
}
}
|