module-puppetdb/manifests/server/jetty_ini.pp
Drew Blessing 57445ef70f 17594 - PuppetDB - Add ability to set standard host listen address and open firewall to standard port
Prior to this commit the module did not provide a way to set a bind address for the HTTP port.  This
commit allows users to not only bind to an address and port other than localhost and 8080, but it also
opens the firewall if explicitly requested.
2012-11-14 09:00:15 -06:00

69 lines
2.3 KiB
Puppet

# Class: puppetdb::server::jetty_ini
#
# This class manages puppetdb's `jetty.ini` file, which contains the configuration
# for puppetdb's embedded web server.
#
# Parameters:
# ['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).
# ['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.
# ['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(
$listen_address = $puppetdb::params::listen_address,
$listen_port = $puppetdb::params::listen_port,
$ssl_listen_address = $puppetdb::params::ssl_listen_address,
$ssl_listen_port = $puppetdb::params::ssl_listen_port,
$confdir = $puppetdb::params::confdir,
) inherits puppetdb::params {
#Set the defaults
Ini_setting {
path => "${confdir}/jetty.ini",
ensure => present,
section => 'jetty',
}
# TODO: figure out some way to make sure that the ini_file module is installed,
# because otherwise these will silently fail to do anything.
ini_setting {'puppetdb_host':
setting => 'host',
value => $listen_address,
}
ini_setting {'puppetdb_port':
setting => 'port',
value => $listen_port,
}
ini_setting {'puppetdb_sslhost':
setting => 'ssl-host',
value => $ssl_listen_address,
}
ini_setting {'puppetdb_sslport':
setting => 'ssl-port',
value => $ssl_listen_port,
}
}