diff --git a/manifests/init.pp b/manifests/init.pp index cf73405..44a4e93 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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, } diff --git a/manifests/master/config.pp b/manifests/master/config.pp index 3fe770c..dc6d76d 100644 --- a/manifests/master/config.pp +++ b/manifests/master/config.pp @@ -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] } } diff --git a/manifests/master/puppetdb_conf.pp b/manifests/master/puppetdb_conf.pp index 9f4a47d..5366a0b 100644 --- a/manifests/master/puppetdb_conf.pp +++ b/manifests/master/puppetdb_conf.pp @@ -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 { diff --git a/manifests/master/routes.pp b/manifests/master/routes.pp index 4f5a7f7..8fdb4a6 100644 --- a/manifests/master/routes.pp +++ b/manifests/master/routes.pp @@ -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; diff --git a/manifests/master/storeconfigs.pp b/manifests/master/storeconfigs.pp index 35ec160..7e08872 100644 --- a/manifests/master/storeconfigs.pp +++ b/manifests/master/storeconfigs.pp @@ -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{ diff --git a/manifests/params.pp b/manifests/params.pp index f8d8ed2..20287a9 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -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' } diff --git a/manifests/server.pp b/manifests/server.pp index b0f0ade..ed26e3c 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -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] } diff --git a/tests/pe-puppetdb-postgres.pp b/tests/pe-puppetdb-postgres.pp new file mode 100644 index 0000000..51f2ec9 --- /dev/null +++ b/tests/pe-puppetdb-postgres.pp @@ -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', + } +}