From df6f7cc34555a4e28b41550dd56be0685ec2d39c Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Fri, 28 Sep 2012 11:03:19 -0700 Subject: [PATCH 1/3] Add parameters to enable usage of enterprise versions of PuppetDB --- manifests/init.pp | 6 ++++++ manifests/master/config.pp | 20 +++++++++++--------- manifests/master/puppetdb_conf.pp | 2 +- manifests/master/routes.pp | 2 +- manifests/master/storeconfigs.pp | 2 +- manifests/params.pp | 7 ++++++- manifests/server.pp | 16 +++++++++------- 7 files changed, 35 insertions(+), 20 deletions(-) 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..815b7d8 100644 --- a/manifests/master/config.pp +++ b/manifests/master/config.pp @@ -47,14 +47,16 @@ class puppetdb::master::config( $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..ae06e07 100644 --- a/manifests/master/puppetdb_conf.pp +++ b/manifests/master/puppetdb_conf.pp @@ -25,7 +25,7 @@ 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..917bca3 100644 --- a/manifests/master/routes.pp +++ b/manifests/master/routes.pp @@ -22,7 +22,7 @@ # 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..d546c1d 100644 --- a/manifests/master/storeconfigs.pp +++ b/manifests/master/storeconfigs.pp @@ -21,7 +21,7 @@ # 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..a412e5f 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -31,7 +31,6 @@ class puppetdb::params { $manage_redhat_firewall = true $gc_interval = '60' - $confdir = '/etc/puppetdb/conf.d' case $::osfamily { 'RedHat': { @@ -50,5 +49,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] } From 850e039500ea8ba2d7872cc210c1317602d8da17 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Mon, 1 Oct 2012 10:28:57 -0700 Subject: [PATCH 2/3] Adding pe_puppetdb tests class --- tests/pe-puppetdb-postgres.pp | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 tests/pe-puppetdb-postgres.pp diff --git a/tests/pe-puppetdb-postgres.pp b/tests/pe-puppetdb-postgres.pp new file mode 100644 index 0000000..5e828be --- /dev/null +++ b/tests/pe-puppetdb-postgres.pp @@ -0,0 +1,7 @@ +class pe_puppetdb { + class { 'puppetdb': + puppetdb_package => 'pe-puppetdb', + puppetdb_service => 'pe-puppetdb', + confdir => '/etc/puppetlabs/puppetdb/conf.d', + } +} From b5df5d919759f7255c36f47e0f8e60f25a5849fa Mon Sep 17 00:00:00 2001 From: Chris Price Date: Mon, 1 Oct 2012 10:46:33 -0700 Subject: [PATCH 3/3] Update comments and docs w/rt PE params This is just a small add-on to Hunter's commits where he added extra parameters to support PE. This commit just cleans up some of my old comments that were made irrelevant or inaccurate due to the work that he did, and adds a bit of documentation to the new test manifest that he created. --- manifests/master/config.pp | 2 +- manifests/master/puppetdb_conf.pp | 2 +- manifests/master/routes.pp | 2 -- manifests/master/storeconfigs.pp | 2 -- manifests/params.pp | 2 -- tests/pe-puppetdb-postgres.pp | 3 +++ 6 files changed, 5 insertions(+), 8 deletions(-) diff --git a/manifests/master/config.pp b/manifests/master/config.pp index 815b7d8..dc6d76d 100644 --- a/manifests/master/config.pp +++ b/manifests/master/config.pp @@ -40,7 +40,7 @@ # puppetdb_port => 8081, # } # -# TODO: port this to use params +# TODO: finish porting this to use params # class puppetdb::master::config( $puppetdb_server = $::clientcert, diff --git a/manifests/master/puppetdb_conf.pp b/manifests/master/puppetdb_conf.pp index ae06e07..5366a0b 100644 --- a/manifests/master/puppetdb_conf.pp +++ b/manifests/master/puppetdb_conf.pp @@ -20,7 +20,7 @@ # } # # -# TODO: port this to use params +# TODO: finish porting this to use params # class puppetdb::master::puppetdb_conf( $server = 'localhost', diff --git a/manifests/master/routes.pp b/manifests/master/routes.pp index 917bca3..8fdb4a6 100644 --- a/manifests/master/routes.pp +++ b/manifests/master/routes.pp @@ -19,8 +19,6 @@ # } # # -# TODO: port this to use params -# class puppetdb::master::routes( $puppet_confdir = $puppetdb::params::puppet_confdir, ) { diff --git a/manifests/master/storeconfigs.pp b/manifests/master/storeconfigs.pp index d546c1d..7e08872 100644 --- a/manifests/master/storeconfigs.pp +++ b/manifests/master/storeconfigs.pp @@ -18,8 +18,6 @@ # } # # -# TODO: port this to use params -# class puppetdb::master::storeconfigs( $puppet_conf = $puppetdb::params::puppet_conf ) { diff --git a/manifests/params.pp b/manifests/params.pp index a412e5f..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' diff --git a/tests/pe-puppetdb-postgres.pp b/tests/pe-puppetdb-postgres.pp index 5e828be..51f2ec9 100644 --- a/tests/pe-puppetdb-postgres.pp +++ b/tests/pe-puppetdb-postgres.pp @@ -1,3 +1,6 @@ +# 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',