Puppet Class: puppetmaster

Defined in:
modules/puppetmaster/manifests/init.pp

Overview

Parameters:

  • server_name (String[1]) (defaults to: 'puppet')
  • bind_address (String[1]) (defaults to: '*')
  • verify_client (Httpd::SSLVerifyClient) (defaults to: 'optional')
  • server_type (Puppetmaster::Server_type) (defaults to: 'standalone')
  • config (Hash) (defaults to: {})
  • is_git_master (Boolean) (defaults to: false)
  • hiera_config (String[1]) (defaults to: 'production')
  • secure_private (Boolean) (defaults to: true)
  • prevent_cherrypicks (Boolean) (defaults to: true)
  • git_user (String[1]) (defaults to: 'gitpuppet')
  • git_group (String[1]) (defaults to: 'gitpuppet')
  • enable_geoip (Boolean) (defaults to: true)
  • ca_server (Stdlib::Host) (defaults to: $facts['networking']['fqdn'])
  • ssl_verify_depth (Integer[1,2]) (defaults to: 1)
  • use_r10k (Boolean) (defaults to: false)
  • netbox_hiera_enable (Boolean) (defaults to: false)
  • enable_merge_cli (Boolean) (defaults to: false)
  • upload_facts (Boolean) (defaults to: false)
  • r10k_sources (Hash[String, Puppetmaster::R10k::Source]) (defaults to: {})
  • servers (Hash[String, Puppetmaster::Backends]) (defaults to: {})
  • http_proxy (Optional[Stdlib::HTTPUrl]) (defaults to: undef)
  • extra_auth_rules (Optional[String]) (defaults to: undef)
  • realm_override (Optional[String]) (defaults to: undef)


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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'modules/puppetmaster/manifests/init.pp', line 34

class puppetmaster(
    String[1]                                $server_name        = 'puppet',
    String[1]                                $bind_address       = '*',
    Httpd::SSLVerifyClient                   $verify_client      = 'optional',
    Puppetmaster::Server_type                $server_type        = 'standalone',
    Hash                                     $config             = {},
    Boolean                                  $is_git_master       = false,
    String[1]                                $hiera_config        = 'production',
    Boolean                                  $secure_private      = true,
    Boolean                                  $prevent_cherrypicks = true,
    String[1]                                $git_user            = 'gitpuppet',
    String[1]                                $git_group           = 'gitpuppet',
    Boolean                                  $enable_geoip        = true,
    Stdlib::Host                             $ca_server           = $facts['networking']['fqdn'],
    Integer[1,2]                             $ssl_verify_depth    = 1,
    Boolean                                  $use_r10k            = false,
    Boolean                                  $netbox_hiera_enable = false,
    Boolean                                  $enable_merge_cli    = false,
    Boolean                                  $upload_facts        = false,
    Hash[String, Puppetmaster::R10k::Source] $r10k_sources        = {},
    Hash[String, Puppetmaster::Backends]     $servers             = {},
    Optional[Stdlib::HTTPUrl]                $http_proxy          = undef,
    Optional[String]                         $extra_auth_rules    = undef,
    Optional[String]                         $realm_override      = undef,
){

    $workers = $servers[$facts['fqdn']]
    $gitdir = '/var/lib/git'
    $volatiledir = '/var/lib/puppet/volatile'

    # This is required to talk to our custom enc
    ensure_packages(['ruby-httpclient'])

    # Require /etc/puppet.conf to be in place,
    # so the postinst scripts do the right things.
    class { 'puppetmaster::config':
        config      => $config,
        server_type => $server_type,
    }

    package { [
        'vim-puppet',
        'rails',
        'ruby-json',
        ]:
        ensure  => present,
    }

    class { 'puppetmaster::passenger':
        bind_address  => $bind_address,
        verify_client => $verify_client,
    }

    $ssl_settings = ssl_ciphersuite('apache', 'strong')

    # path and name change with puppet 4 packages
    $puppetmaster_rack_path = '/usr/share/puppet/rack/puppet-master'

    # Part dependent on the server_type
    case $server_type {
        'frontend': {

            httpd::site { 'puppetmaster.wikimedia.org':
                ensure => absent,
            }

            httpd::site { 'puppetmaster-backend':
                content      => template('puppetmaster/puppetmaster-backend.conf.erb'),
            }
        }
        'backend': {
            httpd::site { 'puppetmaster-backend':
                content => template('puppetmaster/puppetmaster-backend.conf.erb'),
            }
        }
        default: {
            httpd::site { 'puppetmaster.wikimedia.org':
                content => template('puppetmaster/puppetmaster.erb'),
            }
        }
    }

    class { 'puppetmaster::ssl':
        server_name => $server_name,
    }

    class { 'puppetmaster::gitclone':
        secure_private      => $secure_private,
        is_git_master       => $is_git_master,
        prevent_cherrypicks => $prevent_cherrypicks,
        user                => $git_user,
        group               => $git_group,
        servers             => $servers,
        netbox_hiera_enable => $netbox_hiera_enable,
        use_r10k            => $use_r10k,
        r10k_sources        => $r10k_sources,
    }

    include puppetmaster::monitoring

    if has_key($config, 'storeconfigs_backend') and $config['storeconfigs_backend'] == 'puppetdb' {
        $has_puppetdb = true
    } else {
        $has_puppetdb = false
    }

    class { 'puppetmaster::scripts' :
        has_puppetdb   => $has_puppetdb,
        upload_facts   => $upload_facts,
        http_proxy     => $http_proxy,
        realm_override => $realm_override,
    }

    class { 'puppetmaster::merge_cli':
        ensure    => $enable_merge_cli.bool2str('present', 'absent'),
        servers   => $servers,
        ca_server => $ca_server,
    }

    if $enable_geoip {
        class { 'puppetmaster::geoip':
            ca_server => $ca_server,
        }
    }
    include puppetmaster::gitpuppet
    include puppetmaster::generators

    file { '/etc/puppet/auth.conf':
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
        content => template('puppetmaster/auth-master.conf.erb'),
    }

    file { '/etc/puppet/hiera.yaml':
        # We dont want global hiera when using r10k
        ensure => stdlib::ensure(!$use_r10k, 'file'),
        owner  => 'root',
        group  => 'root',
        mode   => '0444',
        source => "puppet:///modules/puppetmaster/hiera/${hiera_config}.yaml",
        notify => Service['apache2'],
    }

    # Small utility to generate ECDSA certs and submit the CSR to the puppet master
    file { '/usr/local/bin/puppet-ecdsacert':
        ensure => present,
        source => 'puppet:///modules/puppetmaster/puppet_ecdsacert.rb',
        mode   => '0550',
        owner  => 'root',
        group  => 'root',
    }
}