Puppet Class: psick::hosts::file

Defined in:
manifests/hosts/file.pp

Overview

This class manages the content of the /etc/hosts file

Parameters:

  • template (String) (defaults to: 'psick/hosts/file/hosts.erb')

    The erb template to use to manage the content of /etc/hosts

  • ipaddress (Optional[Stdlib::IP::Address]) (defaults to: $psick::primary_ip)

    The IP address to use for the node hostname

  • domain (Variant[Undef,String]) (defaults to: $facts['networking']['domain'])

    the domain to use for the node domain name

  • hostname (String) (defaults to: $facts['networking']['hostname'])

    The hostname to use for the node hostname

  • extra_hosts (Array) (defaults to: [])

    An array of extra lines to add (one line for array element) to /etc/hosts.

  • manage (Boolean) (defaults to: $psick::manage)
  • noop_manage (Boolean) (defaults to: $psick::noop_manage)
  • noop_value (Boolean) (defaults to: $psick::noop_value)


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'manifests/hosts/file.pp', line 10

class psick::hosts::file (
  String $template  = 'psick/hosts/file/hosts.erb',

  Optional[Stdlib::IP::Address] $ipaddress = $psick::primary_ip,
  Variant[Undef,String] $domain = $facts['networking']['domain'],
  String $hostname              = $facts['networking']['hostname'],
  Array $extra_hosts            = [],

  Boolean $manage               = $psick::manage,
  Boolean $noop_manage          = $psick::noop_manage,
  Boolean $noop_value           = $psick::noop_value,
) {
  if $manage {
    if $noop_manage {
      noop($noop_value)
    }

    file { '/etc/hosts':
      ensure  => file,
      content => template($template),
    }
  }
}