2013-10-21 17:21:12 +02:00
|
|
|
# PRIVATE CLASS - do not use directly
|
2015-09-16 00:21:33 +02:00
|
|
|
class puppetdb::server::jetty (
|
2012-11-13 21:38:38 +01:00
|
|
|
$listen_address = $puppetdb::params::listen_address,
|
2013-06-04 14:19:53 +02:00
|
|
|
$listen_port = $puppetdb::params::listen_port,
|
2015-10-13 19:39:15 +02:00
|
|
|
$disable_cleartext = $puppetdb::params::disable_cleartext,
|
2012-09-20 23:46:26 +02:00
|
|
|
$ssl_listen_address = $puppetdb::params::ssl_listen_address,
|
|
|
|
$ssl_listen_port = $puppetdb::params::ssl_listen_port,
|
2013-04-09 00:39:04 +02:00
|
|
|
$disable_ssl = $puppetdb::params::disable_ssl,
|
2014-09-06 01:18:46 +02:00
|
|
|
$ssl_set_cert_paths = $puppetdb::params::ssl_set_cert_paths,
|
|
|
|
$ssl_cert_path = $puppetdb::params::ssl_cert_path,
|
|
|
|
$ssl_key_path = $puppetdb::params::ssl_key_path,
|
|
|
|
$ssl_ca_cert_path = $puppetdb::params::ssl_ca_cert_path,
|
2014-10-17 07:07:45 +02:00
|
|
|
$ssl_protocols = $puppetdb::params::ssl_protocols,
|
2012-09-20 23:46:26 +02:00
|
|
|
$confdir = $puppetdb::params::confdir,
|
2014-06-26 17:15:34 +02:00
|
|
|
$max_threads = $puppetdb::params::max_threads,
|
2016-04-28 13:39:54 +02:00
|
|
|
$puppetdb_user = $puppetdb::params::puppetdb_user,
|
|
|
|
$puppetdb_group = $puppetdb::params::puppetdb_group,
|
2012-09-18 00:26:32 +02:00
|
|
|
) inherits puppetdb::params {
|
2012-09-20 23:46:26 +02:00
|
|
|
|
2016-05-13 21:23:49 +02:00
|
|
|
$jetty_ini = "${confdir}/jetty.ini"
|
|
|
|
|
|
|
|
file { $jetty_ini:
|
2016-04-28 13:39:54 +02:00
|
|
|
ensure => file,
|
2016-05-13 21:23:49 +02:00
|
|
|
owner => $puppetdb_user,
|
|
|
|
group => $puppetdb_group,
|
|
|
|
mode => '0600',
|
2016-04-28 13:39:54 +02:00
|
|
|
}
|
|
|
|
|
2014-10-07 16:06:54 +02:00
|
|
|
# Set the defaults
|
2012-09-18 00:26:32 +02:00
|
|
|
Ini_setting {
|
2016-05-13 21:23:49 +02:00
|
|
|
path => $jetty_ini,
|
2012-09-20 23:46:26 +02:00
|
|
|
ensure => present,
|
|
|
|
section => 'jetty',
|
2016-05-13 21:23:49 +02:00
|
|
|
require => File[$jetty_ini],
|
2012-09-18 00:26:32 +02:00
|
|
|
}
|
|
|
|
|
2015-10-13 19:39:15 +02:00
|
|
|
$cleartext_setting_ensure = $disable_cleartext ? {
|
|
|
|
true => 'absent',
|
|
|
|
default => 'present',
|
|
|
|
}
|
|
|
|
|
2014-10-07 16:06:54 +02:00
|
|
|
ini_setting { 'puppetdb_host':
|
2015-10-13 19:39:15 +02:00
|
|
|
ensure => $cleartext_setting_ensure,
|
2012-11-13 21:38:38 +01:00
|
|
|
setting => 'host',
|
|
|
|
value => $listen_address,
|
|
|
|
}
|
|
|
|
|
2014-10-07 16:06:54 +02:00
|
|
|
ini_setting { 'puppetdb_port':
|
2015-10-13 19:39:15 +02:00
|
|
|
ensure => $cleartext_setting_ensure,
|
2012-11-13 21:38:38 +01:00
|
|
|
setting => 'port',
|
|
|
|
value => $listen_port,
|
|
|
|
}
|
|
|
|
|
2013-04-09 00:39:04 +02:00
|
|
|
$ssl_setting_ensure = $disable_ssl ? {
|
|
|
|
true => 'absent',
|
|
|
|
default => 'present',
|
|
|
|
}
|
|
|
|
|
2014-10-07 16:06:54 +02:00
|
|
|
ini_setting { 'puppetdb_sslhost':
|
|
|
|
ensure => $ssl_setting_ensure,
|
|
|
|
setting => 'ssl-host',
|
|
|
|
value => $ssl_listen_address,
|
|
|
|
}
|
|
|
|
|
|
|
|
ini_setting { 'puppetdb_sslport':
|
|
|
|
ensure => $ssl_setting_ensure,
|
|
|
|
setting => 'ssl-port',
|
|
|
|
value => $ssl_listen_port,
|
|
|
|
}
|
|
|
|
|
2014-10-17 07:07:45 +02:00
|
|
|
if $ssl_protocols != undef {
|
|
|
|
|
|
|
|
validate_string($ssl_protocols)
|
|
|
|
|
|
|
|
ini_setting { 'puppetdb_sslprotocols':
|
|
|
|
ensure => $ssl_setting_ensure,
|
|
|
|
setting => 'ssl-protocols',
|
|
|
|
value => $ssl_protocols,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-06 01:18:46 +02:00
|
|
|
if str2bool($ssl_set_cert_paths) == true {
|
2014-10-16 13:36:23 +02:00
|
|
|
# assume paths have been validated in calling class
|
2014-10-07 16:06:54 +02:00
|
|
|
ini_setting { 'puppetdb_ssl_key':
|
2014-09-06 01:18:46 +02:00
|
|
|
ensure => present,
|
|
|
|
setting => 'ssl-key',
|
|
|
|
value => $ssl_key_path,
|
|
|
|
}
|
2014-10-07 16:06:54 +02:00
|
|
|
ini_setting { 'puppetdb_ssl_cert':
|
2014-09-06 01:18:46 +02:00
|
|
|
ensure => present,
|
|
|
|
setting => 'ssl-cert',
|
|
|
|
value => $ssl_cert_path,
|
|
|
|
}
|
2014-10-07 16:06:54 +02:00
|
|
|
ini_setting { 'puppetdb_ssl_ca_cert':
|
2014-09-06 01:18:46 +02:00
|
|
|
ensure => present,
|
|
|
|
setting => 'ssl-ca-cert',
|
|
|
|
value => $ssl_ca_cert_path,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-26 17:15:34 +02:00
|
|
|
if ($max_threads) {
|
2014-10-07 16:06:54 +02:00
|
|
|
ini_setting { 'puppetdb_max_threads':
|
2014-06-26 17:15:34 +02:00
|
|
|
setting => 'max-threads',
|
|
|
|
value => $max_threads,
|
|
|
|
}
|
|
|
|
} else {
|
2014-10-07 16:06:54 +02:00
|
|
|
ini_setting { 'puppetdb_max_threads':
|
2014-06-26 17:15:34 +02:00
|
|
|
ensure => absent,
|
|
|
|
setting => 'max-threads',
|
|
|
|
}
|
|
|
|
}
|
2012-09-18 00:26:32 +02:00
|
|
|
}
|