The following example shows how you might manage naming services configuration with Puppet by declaring the service resource type in a Puppet manifest.
Example 7 Configuring Naming Services With PuppetIn the following example, the DNS service is enabled and a DNS server is configured. Then, the domainname property is set. Finally, the name service switch values are specified.
service { "dns/client":
ensure => running,
}
svccfg { "domainname":
ensure => present
fmri => "svc:/network/nis/domain",
property => "config/domainname",
type => "hostname",
value => "company.com",
notify => Service[‘dns/client'],
}
svccfg { "nameserver":
ensure => present,
fmri: => "svc:/network/dns/client",
property => "config/nameserver",
type => "net_address",
value => "1.2.3.4"
notify => Service[‘dns/client'],
}
# nameservice switch
nsswitch { "dns + ldap":
default => "files",
host => "files dns",
password => "files ldap",
group => "files ldap",
automount => "files ldap",
netgroup => "ldap",
}