Puppet Class: puppetmaster

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

Overview

Parameters:

  • server_name (String[1]) (defaults to: 'puppet')

    name of the server

  • bind_address (String[1]) (defaults to: '*')

    The IP address Apache will bind to

  • verify_client (Httpd::SSLVerifyClient) (defaults to: 'optional')

    Whether apache mod_ssl will verify the client (SSLVerifyClient option)

  • allow_from (Array[String]) (defaults to: [ '*.wikimedia.org', '*.eqiad.wmnet', '*.ulsfo.wmnet', '*.esams.wmnet', '*.codfw.wmnet', '*.eqsin.wmnet', '*.drmrs.wmnet', ])

    Adds an Allow from statement (order Allow,Deny), limiting access to the passenger service.

  • deny_from (Array[String]) (defaults to: [])

    Adds a Deny from statement (order Allow,Deny), limiting access to the passenger service.

  • server_type (Puppetmaster::Server_type) (defaults to: 'standalone')

    frontend, backend or standalone

  • config (Hash) (defaults to: {})

    Hash containing all config settings for the [master] section of puppet.conf (ini-style)

  • hiera_config (String[1]) (defaults to: $::realm)

    Specifies which file to use for hiera.yaml. Defaults to $::realm

  • is_git_master (Boolean) (defaults to: false)

    If True, the git private repository here will be considered a master

  • secure_private (Boolean) (defaults to: true)

    If true, some magic is done to have local repositories and sync between puppetmasters. Otherwise, /etc/puppet/private will be labs/private.git.

  • extra_auth_rules (Optional[String]) (defaults to: undef)

    extra authentication rules to add before the default policy.

  • prevent_cherrypicks (Boolean) (defaults to: true)

    use git hooks to prevent cherry picking on top of the git repo

  • git_user (String[1]) (defaults to: 'gitpuppet')

    name of user who should own the git repositories

  • git_group (String[1]) (defaults to: 'gitpuppet')

    name of group which should own the git repositories

  • enable_geoip (Boolean) (defaults to: true)

    Provision puppetmaster::geoip for serving clients who use the geoip::data::puppet class in their manifests

  • ca_server (Stdlib::Host) (defaults to: $facts['networking']['fqdn'])

    FQDN of the CA server

  • ssl_verify_depth (Integer[1,2]) (defaults to: 1)

    Depth to verify client certificates

  • netbox_hiera_enable (Boolean) (defaults to: false)

    add the netbox-hiera repo

  • use_r10k (Boolean) (defaults to: false)

    Weather to use r10k

  • upload_facts (Boolean) (defaults to: false)
  • r10k_sources (Hash[String, Puppetmaster::R10k::Source]) (defaults to: {})

    the r10k sources to configure

  • servers (Hash[String, Puppetmaster::Backends]) (defaults to: {})

    Hash of puppetmaster servers, their workers and loadfactors

  • http_proxy (Optional[Stdlib::HTTPUrl]) (defaults to: undef)

    The http_proxy to use if required



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
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
187
188
189
# File 'modules/puppetmaster/manifests/init.pp', line 30

class puppetmaster(
    String[1]                                $server_name        = 'puppet',
    String[1]                                $bind_address       = '*',
    Httpd::SSLVerifyClient                   $verify_client      = 'optional',
    Array[String]                            $deny_from          = [],
    Puppetmaster::Server_type                $server_type        = 'standalone',
    Hash                                     $config             = {},
    Array[String]                            $allow_from         = [
                                                                    '*.wikimedia.org',
                                                                    '*.eqiad.wmnet',
                                                                    '*.ulsfo.wmnet',
                                                                    '*.esams.wmnet',
                                                                    '*.codfw.wmnet',
                                                                    '*.eqsin.wmnet',
                                                                    '*.drmrs.wmnet',
                                                                  ],
    Boolean                                  $is_git_master       = false,
    String[1]                                $hiera_config        = $::realm,
    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                                  $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
){

    $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,
        allow_from    => $allow_from,
        deny_from     => $deny_from,
    }

    $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' :
        servers      => $servers,
        has_puppetdb => $has_puppetdb,
        ca_server    => $ca_server,
        upload_facts => $upload_facts,
        http_proxy   => $http_proxy,
    }

    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'),
    }

    $hiera_source = "puppet:///modules/puppetmaster/${hiera_config}.hiera.yaml"

    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 => $hiera_source,
        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',
    }
}