Puppet Class: profile::puppetmaster::frontend

Defined in:
modules/profile/manifests/puppetmaster/frontend.pp

Overview

Parameters:

  • config (Hash) (defaults to: lookup('profile::puppetmaster::frontend::config'))
  • secure_private (Boolean) (defaults to: lookup('profile::puppetmaster::frontend::secure_private'))
  • web_hostname (String) (defaults to: lookup('profile::puppetmaster::frontend::web_hostname'))
  • prevent_cherrypicks (Boolean) (defaults to: lookup('profile::puppetmaster::frontend::prevent_cherrypicks'))
  • ca_server (Stdlib::Host) (defaults to: lookup('puppet_ca_server'))
  • ca_source (Stdlib::Filesource) (defaults to: lookup('puppet_ca_source'))
  • manage_ca_file (Boolean) (defaults to: lookup('manage_puppet_ca_file'))
  • allow_from (Array[String]) (defaults to: lookup('profile::puppetmaster::frontend::allow_from'))
  • extra_auth_rules (String) (defaults to: lookup('profile::puppetmaster::frontend::extra_auth_rules'))
  • canary_hosts (Array[Stdlib::Host]) (defaults to: lookup('profile::puppetmaster::frontend::canary_hosts'))
  • servers (Hash[String, Puppetmaster::Backends]) (defaults to: lookup('puppetmaster::servers'))
  • locale_servers (Hash[Stdlib::Host, Stdlib::Host]) (defaults to: lookup('puppetmaster::locale_servers'))
  • ssl_ca_revocation_check (Enum['chain', 'leaf', 'none']) (defaults to: lookup('profile::puppetmaster::frontend::ssl_ca_revocation_check'))
  • mcrouter_ca_secret (Optional[String[1]]) (defaults to: lookup('profile::puppetmaster::frontend::mcrouter_ca_secret', {'default_value' => undef}))


3
4
5
6
7
8
9
10
11
12
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'modules/profile/manifests/puppetmaster/frontend.pp', line 3

class profile::puppetmaster::frontend(
    Hash                $config                  = lookup('profile::puppetmaster::frontend::config'),
    Boolean             $secure_private          = lookup('profile::puppetmaster::frontend::secure_private'),
    String              $web_hostname            = lookup('profile::puppetmaster::frontend::web_hostname'),
    Boolean             $prevent_cherrypicks     = lookup('profile::puppetmaster::frontend::prevent_cherrypicks'),
    Stdlib::Host        $ca_server               = lookup('puppet_ca_server'),
    Stdlib::Filesource  $ca_source               = lookup('puppet_ca_source'),
    Boolean             $manage_ca_file          = lookup('manage_puppet_ca_file'),
    Array[String]       $allow_from              = lookup('profile::puppetmaster::frontend::allow_from'),
    String              $extra_auth_rules        = lookup('profile::puppetmaster::frontend::extra_auth_rules'),
    Array[Stdlib::Host] $canary_hosts            = lookup('profile::puppetmaster::frontend::canary_hosts'),
    Hash[String, Puppetmaster::Backends] $servers          = lookup('puppetmaster::servers'),
    Hash[Stdlib::Host, Stdlib::Host]     $locale_servers   = lookup('puppetmaster::locale_servers'),
    Enum['chain', 'leaf', 'none'] $ssl_ca_revocation_check = lookup('profile::puppetmaster::frontend::ssl_ca_revocation_check'),
    Optional[String[1]] $mcrouter_ca_secret      = lookup('profile::puppetmaster::frontend::mcrouter_ca_secret',
                                                          {'default_value' => undef}),
) {
    backup::set { 'var-lib-puppet-ssl': }
    backup::set { 'var-lib-puppet-volatile': }
    if $manage_ca_file {
        file{[$facts['puppet_config']['master']['localcacert'],
              "${facts['puppet_config']['master']['ssldir']}/ca/ca_crt.pem"]:
            ensure => file,
            owner  => 'puppet',
            group  => 'puppet',
            source => $ca_source,
        }
    }
    # Puppet frontends are git masters at least for their datacenter
    if $ca_server == $::fqdn {
        $ca = true
        $cron = 'absent'
    } else {
        $ca = false
        $cron = 'present'
    }

    if $ca {
        # Ensure cergen is present for managing TLS keys and
        # x509 certificates signed by the Puppet CA.
        class { 'cergen': }
        if $mcrouter_ca_secret {
            class { 'cergen::mcrouter_ca':
                ca_secret => $mcrouter_ca_secret,
            }
        }

        # Ship cassandra-ca-manager (precursor of cergen)
        class { 'cassandra::ca_manager': }
    }

    class { '::httpd':
        modules => ['proxy',
                    'proxy_http',
                    'proxy_balancer',
                    'passenger',
                    'rewrite',
                    'lbmethod_byrequests'],
    }

    require_package('libapache2-mod-passenger')

    class { 'puppetmaster::ca_server':
        master => $ca_server
    }

    ## Configuration
    $workers = $servers[$::fqdn]

    $common_config = {
        'ca'              => $ca,
        'ca_server'       => $ca_server,
        'stringify_facts' => false,
    }

    $base_config = merge($config, $common_config)

    class { 'profile::puppetmaster::common':
        base_config => $base_config,
    }

    class { 'puppetmaster':
        bind_address        => '*',
        server_type         => 'frontend',
        is_git_master       => true,
        workers             => $workers,
        config              => $profile::puppetmaster::common::config,
        secure_private      => $secure_private,
        prevent_cherrypicks => $prevent_cherrypicks,
        allow_from          => $allow_from,
        extra_auth_rules    => $extra_auth_rules,
        ca_server           => $ca_server,
        ssl_verify_depth    => $profile::puppetmaster::common::ssl_verify_depth,
    }

    $locale_server = $locale_servers[$facts['fqdn']]
    # Main site to respond to
    puppetmaster::web_frontend { $web_hostname:
        master                  => $ca_server,
        workers                 => $workers,
        locale_server           => $locale_server,
        bind_address            => $::puppetmaster::bind_address,
        priority                => 40,
        ssl_ca_revocation_check => $ssl_ca_revocation_check,
        canary_hosts            => $canary_hosts,
        ssl_verify_depth        => $profile::puppetmaster::common::ssl_verify_depth,
    }

    # On all the puppetmasters, we should respond
    # to the FQDN too, in case we point them explicitly
    puppetmaster::web_frontend { $::fqdn:
        master                  => $ca_server,
        workers                 => $workers,
        locale_server           => $locale_server,
        bind_address            => $::puppetmaster::bind_address,
        priority                => 50,
        ssl_ca_revocation_check => $ssl_ca_revocation_check,
        canary_hosts            => $canary_hosts,
        ssl_verify_depth        => $profile::puppetmaster::common::ssl_verify_depth,
    }

    # Run the rsync servers on all puppetmaster frontends, and activate
    # crons syncing from the master
    class { '::puppetmaster::rsync':
        server      => $ca_server,
        cron_ensure => $cron,
        frontends   => keys($servers),
    }

    ferm::service { 'puppetmaster-frontend':
        proto => 'tcp',
        port  => 8140,
    }

    $puppetmaster_frontend_ferm = join(keys($servers), ' ')
    ferm::service { 'ssh_puppet_merge':
        proto  => 'tcp',
        port   => '22',
        srange => "(@resolve((${puppetmaster_frontend_ferm})) @resolve((${puppetmaster_frontend_ferm}), AAAA))"
    }

    ferm::service { 'rsync_puppet_frontends':
        proto  => 'tcp',
        port   => '873',
        srange => "(@resolve((${puppetmaster_frontend_ferm})) @resolve((${puppetmaster_frontend_ferm}), AAAA))"
    }
    ferm::service { 'puppetmaster-backend':
        proto  => 'tcp',
        port   => 8141,
        srange => "(@resolve((${puppetmaster_frontend_ferm})) @resolve((${puppetmaster_frontend_ferm}), AAAA))"
    }
}