Puppet Class: puppet::profile::server

Inherits:
puppet::params
Defined in:
manifests/profile/server.pp

Summary

Puppet server installation

Overview

Puppet single host installation (Puppet Agent/Server/PuppetDB)

Examples:

include puppet::profile::server

Parameters:

  • sameca (Boolean) (defaults to: true)
  • platform_name (Puppet::Platform) (defaults to: 'puppet7')
  • server (String) (defaults to: 'puppet')
  • server_ipaddress (String) (defaults to: '127.0.0.1')
  • use_puppetdb (Boolean) (defaults to: true)

    Boolean. Default is true. If set puppet.conf will be set to use PuppetDB for storeconfigs and reports storage. Also PuppetDB will be managed through puppetlabs-puppetdb module (including PostgreSQL database)

  • puppetdb_local (Boolean) (defaults to: true)
  • puppetdb_server (String) (defaults to: 'puppet')

    String. Default is ‘puppet’. Server name for PuppetDB. Puppetdb::Master::Config class (from puppetlabs-puppetdb) use ::fqdn for check connection to PuppetDB server. As ::fqdn could be not resolvable it is possible to set up server name via parameter puppetdb_server. Class ‘::puppet’ by default set into /etc/hosts file record 127.0.0.1 puppet therefore hostname ‘puppet’ is resolvable. If you changed this behavior - you should properly set parameter puppetdb_server as well

  • puppetdb_ssl_protocols (Array[String]) (defaults to: ['TLSv1.2', 'TLSv1.3'])
  • puppetdb_cipher_suites (Array[String]) (defaults to: [ 'TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256', 'TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256', 'TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384', 'TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384', 'TLS_DHE_RSA_WITH_AES_256_GCM_SHA384', 'TLS_DHE_RSA_WITH_AES_128_GCM_SHA256', ])
  • manage_puppet_config (Boolean) (defaults to: false)

    Boolean. Default is false. If set then class Puppetdb::Master::Config will check puppet.conf (using Ini_setting resources) for proper setup of report/reports and storeconfigs/storeconfigs_backend directives. By default class Puppet generates Puppet config from template therefore we do not manage it inside class Puppetdb::Master::Config.

  • postgres_local (Boolean) (defaults to: true)
  • manage_database (Boolean) (defaults to: $postgres_local)

    Boolean. Default is true. If set then class Puppetdb will use puppetlabs/postgresql for Postgres database server management and PuppetDB database setup

  • postgres_database_host (Stdlib::Host) (defaults to: 'localhost')
  • postgres_database_name (String) (defaults to: 'puppetdb')
  • postgres_database_username (String) (defaults to: 'puppetdb')
  • postgres_database_password (String) (defaults to: 'puppetdb')
  • manage_puppetdb_firewall (Boolean) (defaults to: false)

    Boolean. Default is false. If set than class Puppetdb::Server will use puppetlabs/firewall for firewall rules setup, iptables/ip6tables services management

  • r10k_cachedir (Stdlib::Unixpath) (defaults to: $puppet::params::r10k_cachedir)
  • hosts_update (Boolean) (defaults to: true)
  • import_path (Stdlib::Unixpath) (defaults to: '/root/ca')
  • use_common_env (Boolean) (defaults to: false)
  • common_envname (Optional[String]) (defaults to: undef)
  • ca_server (Optional[Stdlib::Host]) (defaults to: undef)
  • enc_envname (Optional[String]) (defaults to: undef)

    The name of ENC environment inside Puppet environments path. Use it to override default value ‘enc’

  • r10k_crontab_setup (Boolean) (defaults to: false)

    Whether to setup crontab job to sync Puppet code

  • manage_webserver_conf (Boolean) (defaults to: false)

    Whether to manage webserver.conf or not

  • manage_fileserver_config (Boolean) (defaults to: true)
  • mount_points (Hash[String, Stdlib::Absolutepath]) (defaults to: {})


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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'manifests/profile/server.pp', line 73

class puppet::profile::server (
  Boolean $sameca = true,
  Puppet::Platform $platform_name = 'puppet7',
  String $server = 'puppet',
  String $server_ipaddress = '127.0.0.1',
  Boolean $use_puppetdb = true,
  Boolean $puppetdb_local = true,
  String $puppetdb_server = 'puppet',
  Array[String] $puppetdb_ssl_protocols = ['TLSv1.2', 'TLSv1.3'],
  Array[String] $puppetdb_cipher_suites = [
    'TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256',
    'TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256',
    'TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384',
    'TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384',
    'TLS_DHE_RSA_WITH_AES_256_GCM_SHA384',
    'TLS_DHE_RSA_WITH_AES_128_GCM_SHA256',
  ],
  Boolean $manage_puppet_config = false,
  Boolean $postgres_local = true,
  Boolean $manage_database = $postgres_local,
  Stdlib::Host $postgres_database_host = 'localhost',
  String $postgres_database_name = 'puppetdb',
  String $postgres_database_username = 'puppetdb',
  String $postgres_database_password = 'puppetdb',
  Boolean $manage_puppetdb_firewall = false,
  Stdlib::Unixpath $r10k_cachedir = $puppet::params::r10k_cachedir,
  Boolean $hosts_update = true,
  Stdlib::Unixpath $import_path = '/root/ca',
  Boolean $use_common_env = false,
  Optional[String] $common_envname = undef,
  Optional[Stdlib::Host] $ca_server = undef,
  Optional[String] $enc_envname  = undef,
  Boolean $r10k_crontab_setup = false,
  Boolean $manage_webserver_conf = false,
  Boolean $manage_fileserver_config = true,
  Hash[String, Stdlib::Absolutepath] $mount_points = {},
) inherits puppet::params {
  # https://tickets.puppetlabs.com/browse/SERVER-346
  class { 'puppet':
    master           => true,
    server           => $server,
    server_ipaddress => $server_ipaddress,
    use_puppetdb     => $use_puppetdb,
    sameca           => $sameca,
    use_common_env   => $use_common_env,
    common_envname   => $common_envname,
    enc_envname      => $enc_envname,
  }

  class { 'puppet::globals':
    platform_name => $platform_name,
  }

  class { 'puppet::agent::install': }
  class { 'puppet::server::install': }

  class { 'puppet::config':
    puppet_server            => true,
    ca_server                => $ca_server,
    manage_webserver_conf    => $manage_webserver_conf,
    manage_fileserver_config => $manage_fileserver_config,
    mount_points             => $mount_points,
  }

  # r10k is not optional in our workflow, it should replace initial setup with
  # real infrastructure setup.
  class { 'puppet::r10k::gem_install':
    manage_puppet_config => $manage_puppet_config,
    r10k_cachedir        => $r10k_cachedir,
  }

  class { 'puppet::r10k::config':
    r10k_config_setup => false,
    cachedir          => $r10k_cachedir,
  }

  class { 'puppet::server::setup':
    r10k_config_manage => true,
    r10k_crontab_setup => $r10k_crontab_setup,
  }

  Class['puppet::r10k::gem_install'] -> Class['puppet::server::setup']

  # https://puppet.com/docs/puppetdb/latest/install_via_module.html#step-2-assign-classes-to-nodes
  # 1) If you are installing PuppetDB on the same server as your Puppet Server, assign
  #    the `puppetdb` and `puppetdb::master::config` classes to it.
  # 2) If you want to run PuppetDB on its own server with a local PostgreSQL
  #    instance, assign the puppetdb class to it, and assign the puppetdb::master::config
  #    class to your Puppet Server. Make sure to set the class parameters as necessary.
  if $use_puppetdb {
    if $puppetdb_local {
      class { 'puppet::puppetdb':
        manage_database            => $manage_database,
        postgres_database_host     => $postgres_database_host,
        postgres_database_name     => $postgres_database_name,
        postgres_database_username => $postgres_database_username,
        postgres_database_password => $postgres_database_password,
        ssl_protocols              => $puppetdb_ssl_protocols,
        cipher_suites              => $puppetdb_cipher_suites,
        manage_firewall            => $manage_puppetdb_firewall,
      }

      Class['puppet::puppetdb'] -> Class['puppet::service']
    }

    # Notes:
    # 1) as hostname by default is set by class Puppet to `puppet` - use it as
    # PuppetDB server name as well (predefined with profile parameter `puppetdb_server`)
    # 2) By default class Puppet generates Puppet config (puppet.conf) from
    # template therefore we do not want to manage it inside class
    # Puppetdb::Master::Config (see `manage_puppet_config` parameter
    # description)
    # 3) Puppet service resource name provided by Puppet::Service class has
    # name 'puppet-server'
    #
    class { 'puppetdb::master::config':
      puppetdb_server                => $puppetdb_server,
      manage_storeconfigs            => $manage_puppet_config,
      manage_report_processor        => $manage_puppet_config,
      create_puppet_service_resource => false,
      puppet_service_name            => 'puppet-server',
    }

    Class['puppetdb::master::config'] -> Class['puppet::service']
  }

  class { 'puppet::service': }
  class { 'puppet::setup':
    hosts_update => $hosts_update,
  }

  include puppet::agent::schedule

  Class['puppet::agent::install']
  -> Class['puppet::config']
  -> Class['puppet::agent::schedule']
}