Puppet Class: isp3node::base::hosts

Defined in:
manifests/base/hosts.pp

Summary

Manages a nodes hosts entries

Overview

Adds the node itself, all other managed nodes and additional entries from hiera to the hosts file

Examples:

include isp3node::base::hostname
class{'isp3node::base::hostname': entries => {'my-host-name': {ensure => present, ip => '1.2.3.4'}}}

Parameters:

  • hostname (String) (defaults to: lookup('isp3node::base::hostname', String, undef, $facts['networking']['hostname']))

    The servers hostname, defaults to facter

  • domain (String) (defaults to: lookup('isp3node::base::domain', String, undef, $facts['networking']['domain']))

    The servers domain name, defaults to facter

  • ip (String) (defaults to: lookup('isp3node::base::ip', String, undef, $facts['ipaddress']))

    The servers main IP address, defaults to facter

  • entries (Optional[Hash[String, Hash]]) (defaults to: {})

    Hash of additional entries to add to the hostsfile



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'manifests/base/hosts.pp', line 18

class isp3node::base::hosts(
  String $hostname = lookup('isp3node::base::hostname', String, undef, $facts['networking']['hostname']),
  String $domain = lookup('isp3node::base::domain', String, undef, $facts['networking']['domain']),
  String $ip = lookup('isp3node::base::ip', String, undef, $facts['ipaddress']),
  Optional[Hash[String, Hash]] $entries = {}
) {
  # Export own host data
  @@host {"${hostname}.${domain}":
    ensure  => present,
    tag     => ['ispnode'],
    alias   => $hostname,
    ip      => $ip,
    comment => "ISPConfig node ${hostname}, provisioned by puppet"
  }
  Host <<| tag == 'ispnode' |>>

  create_resources(host, $entries)
}