Simple example: a host entry
It makes sense to have static host entries in /etc/hosts
for some nodes since DNS outages may disrupt the services provided by those nodes. Examples of such services are backups, authentication, and kerberos. We'll use LDAP (authentication) in this example. In this scenario, we'll apply the ldap::server
class to any LDAP server and add a collector for Host
entries to our base
class (the base
class will be a default applied to all nodes). First, declare the exported resource in ldap::server
, as shown in the following code snippet:
class ldap::server { @@host {"ldap-$::hostname": host_aliases => ["$::fqdn",'ldap'], ip => "$::ipaddress", } }
This will create an exported entry on any host to which we apply the ldap::server
class. We'll apply this class to node2
and then run Puppet to have the resource exported. After running the Puppet agent on node2
, we will examine the contents of puppetdb, as shown in the following screenshot:
The catalog_resources...