2012-09-18 00:26:32 +02:00
|
|
|
# Class: puppetdb::server::jetty_ini
|
|
|
|
#
|
|
|
|
# This class manages puppetdb's `jetty.ini` file, which contains the configuration
|
|
|
|
# for puppetdb's embedded web server.
|
|
|
|
#
|
|
|
|
# Parameters:
|
2012-11-13 21:38:38 +01:00
|
|
|
# ['listen_address'] - The address that the web server should bind to
|
|
|
|
# for HTTP requests. (defaults to `localhost`.)
|
|
|
|
# ['listen_port'] - The port on which the puppetdb web server should
|
|
|
|
# accept HTTP requests (defaults to 8080).
|
2012-09-18 00:26:32 +02:00
|
|
|
# ['ssl_listen_address'] - The address that the web server should bind to
|
|
|
|
# for HTTPS requests. (defaults to `$::clientcert`.)
|
|
|
|
# ['ssl_listen_port'] - The port on which the puppetdb web server should
|
|
|
|
# accept HTTPS requests.
|
2013-04-09 00:39:04 +02:00
|
|
|
# ['disable_ssl'] - If true, disable HTTPS and only serve
|
|
|
|
# HTTP requests. Defaults to false.
|
2012-09-18 00:26:32 +02:00
|
|
|
# ['database_name'] - The name of the database instance to connect to.
|
|
|
|
# (defaults to `puppetdb`; ignored for `embedded` db)
|
|
|
|
# ['confdir'] - The puppetdb configuration directory; defaults to
|
|
|
|
# `/etc/puppetdb/conf.d`.
|
|
|
|
#
|
|
|
|
# Actions:
|
|
|
|
# - Manages puppetdb's `jetty.ini` file
|
|
|
|
#
|
|
|
|
# Requires:
|
|
|
|
# - Inifile
|
|
|
|
#
|
|
|
|
# Sample Usage:
|
|
|
|
# class { 'puppetdb::server::jetty_ini':
|
|
|
|
# ssl_listen_address => 'my.https.interface.hostname',
|
|
|
|
# ssl_listen_port => 8081,
|
|
|
|
# }
|
|
|
|
#
|
|
|
|
class puppetdb::server::jetty_ini(
|
2012-11-13 21:38:38 +01:00
|
|
|
$listen_address = $puppetdb::params::listen_address,
|
|
|
|
$listen_port = $puppetdb::params::listen_port,
|
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,
|
2012-09-20 23:46:26 +02:00
|
|
|
$confdir = $puppetdb::params::confdir,
|
2012-09-18 00:26:32 +02:00
|
|
|
) inherits puppetdb::params {
|
2012-09-20 23:46:26 +02:00
|
|
|
|
2012-09-18 00:26:32 +02:00
|
|
|
#Set the defaults
|
|
|
|
Ini_setting {
|
2012-09-20 23:46:26 +02:00
|
|
|
path => "${confdir}/jetty.ini",
|
|
|
|
ensure => present,
|
|
|
|
section => 'jetty',
|
2012-09-18 00:26:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# TODO: figure out some way to make sure that the ini_file module is installed,
|
|
|
|
# because otherwise these will silently fail to do anything.
|
|
|
|
|
2012-11-13 21:38:38 +01:00
|
|
|
ini_setting {'puppetdb_host':
|
|
|
|
setting => 'host',
|
|
|
|
value => $listen_address,
|
|
|
|
}
|
|
|
|
|
|
|
|
ini_setting {'puppetdb_port':
|
|
|
|
setting => 'port',
|
|
|
|
value => $listen_port,
|
|
|
|
}
|
|
|
|
|
2013-04-09 00:39:04 +02:00
|
|
|
$ssl_setting_ensure = $disable_ssl ? {
|
|
|
|
true => 'absent',
|
|
|
|
default => 'present',
|
|
|
|
}
|
|
|
|
|
2012-09-18 00:26:32 +02:00
|
|
|
ini_setting {'puppetdb_sslhost':
|
2013-04-09 00:39:04 +02:00
|
|
|
ensure => $ssl_setting_ensure,
|
2012-09-20 23:46:26 +02:00
|
|
|
setting => 'ssl-host',
|
|
|
|
value => $ssl_listen_address,
|
2012-09-18 00:26:32 +02:00
|
|
|
}
|
2012-09-20 23:46:26 +02:00
|
|
|
|
2012-09-18 00:26:32 +02:00
|
|
|
ini_setting {'puppetdb_sslport':
|
2013-04-09 00:39:04 +02:00
|
|
|
ensure => $ssl_setting_ensure,
|
2012-09-20 23:46:26 +02:00
|
|
|
setting => 'ssl-port',
|
|
|
|
value => $ssl_listen_port,
|
2012-09-18 00:26:32 +02:00
|
|
|
}
|
|
|
|
}
|