Merge pull request #11 from cprice-puppet/feature/master/params-for-pe

Add parameters to enable usage of enterprise versions of PuppetDB
This commit is contained in:
Chris Price 2012-10-01 10:49:46 -07:00
commit 7dde8c3e36
8 changed files with 47 additions and 28 deletions

View file

@ -39,13 +39,19 @@
#
class puppetdb(
$database = $puppetdb::params::database,
$puppetdb_package = $puppetdb::params::puppetdb_package,
$puppetdb_version = $puppetdb::params::puppetdb_version,
$puppetdb_service = $puppetdb::params::puppetdb_service,
$confdir = $puppetdb::params::confdir,
$manage_redhat_firewall = $puppetdb::params::manage_redhat_firewall,
) inherits puppetdb::params {
class { 'puppetdb::server':
database => $database,
puppetdb_package => $puppetdb_package,
puppetdb_version => $puppetdb_version,
puppetdb_service => $puppetdb_service,
confdir => $confdir,
manage_redhat_firewall => $manage_redhat_firewall,
}

View file

@ -40,21 +40,23 @@
# puppetdb_port => 8081,
# }
#
# TODO: port this to use params
# TODO: finish porting this to use params
#
class puppetdb::master::config(
$puppetdb_server = $::clientcert,
$puppetdb_port = 8081,
$manage_routes = true,
$manage_storeconfigs = true,
$puppet_confdir = '/etc/puppet',
$puppet_conf = '/etc/puppet/puppet.conf',
$puppet_confdir = $puppetdb::params::puppet_confdir,
$puppet_conf = $puppetdb::params::puppet_conf,
$puppetdb_version = $puppetdb::params::puppetdb_version,
$terminus_package = $puppetdb::params::terminus_package,
$puppet_service_name = $puppetdb::params::puppet_service_name,
$restart_puppet = true,
) inherits puppetdb::params {
package { 'puppetdb-terminus':
ensure => $puppetdb_version,
package { $terminus_package:
ensure => $puppetdb_version,
}
# Validate the puppetdb connection. If we can't connect to puppetdb then we
@ -62,7 +64,7 @@ class puppetdb::master::config(
puppetdb_conn_validator { 'puppetdb_conn':
puppetdb_server => $puppetdb_server,
puppetdb_port => $puppetdb_port,
require => Package['puppetdb-terminus'],
require => Package[$terminus_package],
}
# This is a bit of puppet chicanery that allows us to create a
@ -102,14 +104,14 @@ class puppetdb::master::config(
if ($restart_puppet) {
# We will need to restart the puppet master service if certain config
# files are changed, so here we make sure it's in the catalog.
if ! defined(Service[$puppetdb::params::puppet_service_name]) {
service { $puppetdb::params::puppet_service_name:
if ! defined(Service[$puppet_service_name]) {
service { $puppet_service_name:
ensure => running,
}
}
Class['puppetdb::master::puppetdb_conf'] ~> Service[$puppetdb::params::puppet_service_name]
Class['puppetdb::master::routes'] ~> Service[$puppetdb::params::puppet_service_name]
Class['puppetdb::master::puppetdb_conf'] ~> Service[$puppet_service_name]
Class['puppetdb::master::routes'] ~> Service[$puppet_service_name]
}
}

View file

@ -20,12 +20,12 @@
# }
#
#
# TODO: port this to use params
# TODO: finish porting this to use params
#
class puppetdb::master::puppetdb_conf(
$server = 'localhost',
$port = '8081',
$puppet_confdir = '/etc/puppet',
$puppet_confdir = $puppetdb::params::puppet_confdir,
) {
Ini_setting {

View file

@ -19,10 +19,8 @@
# }
#
#
# TODO: port this to use params
#
class puppetdb::master::routes(
$puppet_confdir = '/etc/puppet',
$puppet_confdir = $puppetdb::params::puppet_confdir,
) {
# TODO: this will overwrite any existing routes.yaml;

View file

@ -18,10 +18,8 @@
# }
#
#
# TODO: port this to use params
#
class puppetdb::master::storeconfigs(
$puppet_conf = '/etc/puppet/puppet.conf',
$puppet_conf = $puppetdb::params::puppet_conf
) {
Ini_setting{

View file

@ -11,8 +11,6 @@
# Sample Usage:
#
class puppetdb::params {
# TODO: need to condition this based on whether we are a PE install or not
$ssl_listen_address = $::clientcert
$ssl_listen_port = '8081'
@ -31,7 +29,6 @@ class puppetdb::params {
$manage_redhat_firewall = true
$gc_interval = '60'
$confdir = '/etc/puppetdb/conf.d'
case $::osfamily {
'RedHat': {
@ -50,5 +47,11 @@ class puppetdb::params {
}
# TODO: need to condition this for PE
$puppetdb_package = 'puppetdb'
$puppetdb_service = 'puppetdb'
$confdir = '/etc/puppetdb/conf.d'
$puppet_service_name = 'puppetmaster'
$puppet_confdir = '/etc/puppet'
$puppet_conf = "${puppet_confdir}/puppet.conf"
$terminus_package = 'puppetdb-terminus'
}

View file

@ -76,15 +76,17 @@ class puppetdb::server(
$database_username = $puppetdb::params::database_username,
$database_password = $puppetdb::params::database_password,
$database_name = $puppetdb::params::database_name,
$puppetdb_package = $puppetdb::params::puppetdb_package,
$puppetdb_version = $puppetdb::params::puppetdb_version,
$puppetdb_service = $puppetdb::params::puppetdb_service,
$manage_redhat_firewall = $puppetdb::params::manage_redhat_firewall,
$confdir = $puppetdb::params::confdir,
$gc_interval = $puppetdb::params::gc_interval,
) inherits puppetdb::params {
package { 'puppetdb':
package { $puppetdb_package:
ensure => $puppetdb_version,
notify => Service['puppetdb'],
notify => Service[$puppetdb_service],
}
class { 'puppetdb::server::firewall':
@ -100,24 +102,24 @@ class puppetdb::server(
database_password => $database_password,
database_name => $database_name,
confdir => $confdir,
notify => Service['puppetdb'],
notify => Service[$puppetdb_service],
}
class { 'puppetdb::server::jetty_ini':
ssl_listen_address => $ssl_listen_address,
ssl_listen_port => $ssl_listen_port,
confdir => $confdir,
notify => Service['puppetdb'],
notify => Service[$puppetdb_service],
}
service { 'puppetdb':
service { $puppetdb_service:
ensure => running,
enable => true,
}
Package['puppetdb'] ->
Package[$puppetdb_package] ->
Class['puppetdb::server::firewall'] ->
Class['puppetdb::server::database_ini'] ->
Class['puppetdb::server::jetty_ini'] ->
Service['puppetdb']
Service[$puppetdb_service]
}

View file

@ -0,0 +1,10 @@
# This manifest shows an example of how you might set up puppetdb to work with
# Puppet Enterprise, as opposed to puppet open source.
class pe_puppetdb {
class { 'puppetdb':
puppetdb_package => 'pe-puppetdb',
puppetdb_service => 'pe-puppetdb',
confdir => '/etc/puppetlabs/puppetdb/conf.d',
}
}