Puppet Class: puppet::setup

Inherits:
puppet::params
Defined in:
manifests/setup.pp

Summary

Puppet node environment setup (either agent or server host)

Overview

puppet::setup

Puppet node environment setup

Examples:

include puppet::setup

Parameters:

  • external_facts_setup (Boolean) (defaults to: $puppet::external_facts_setup)

    whether to setup directories for external facts see puppet.com/docs/puppet/6.18/external_facts.html

  • server_name (String) (defaults to: $puppet::server)
  • hosts_update (Boolean) (defaults to: $puppet::hosts_update)
  • server_ipaddress (Optional[String]) (defaults to: $puppet::server_ipaddress)
  • dns_alt_names (Optional[Array[String]]) (defaults to: $puppet::dns_alt_names)
  • wrapper_setup (Boolean) (defaults to: true)


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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
# File 'manifests/setup.pp', line 13

class puppet::setup (
    String  $server_name          = $puppet::server,
    Boolean $hosts_update         = $puppet::hosts_update,
    Optional[String]
            $server_ipaddress     = $puppet::server_ipaddress,
    Optional[Array[String]]
            $dns_alt_names        = $puppet::dns_alt_names,
    Boolean $external_facts_setup = $puppet::external_facts_setup,
    Boolean $wrapper_setup        = true,
) inherits puppet::params
{
    if $hosts_update and $server_ipaddress {
        host { $server_name:
            ensure       => 'present',
            ip           => $server_ipaddress,
            host_aliases => $dns_alt_names,
        }
    }

    if $external_facts_setup {
        # https://puppet.com/docs/puppet/7.5/external_facts.html#executable-fact-locations
        file {
            ['/etc/facter',
            '/etc/facter/facts.d',
            '/opt/puppetlabs/facter',
            '/opt/puppetlabs/facter/facts.d',
            '/etc/puppetlabs/facter',
            '/etc/puppetlabs/facter/facts.d']:
                ensure => directory,
        }
    }

    if $wrapper_setup {
        file { '/usr/local/sbin/agentrun':
            ensure => file,
            group  => 'root',
            owner  => 'root',
            mode   => '0744',
            source => "puppet:///modules/${module_name}/agentrun",
        }
    }
}