From fca0c2b339ede271f07f4cef4863cf91622bc6c9 Mon Sep 17 00:00:00 2001 From: Daniel Dreier Date: Sun, 16 Nov 2014 14:37:27 -0800 Subject: [PATCH] Add basic puppetlabs-puppetdb module integration Use puppetlabs/puppetdb to set up a basic all-in-one puppetmaster Also alphabetizes prameters in server.pp for convenience --- .fixtures.yml | 1 + Modulefile | 1 + manifests/server.pp | 47 +++++++++++++++++++++------------- tests/unicorn_with_puppetdb.pp | 18 +++++++++++++ 4 files changed, 49 insertions(+), 18 deletions(-) create mode 100644 tests/unicorn_with_puppetdb.pp diff --git a/.fixtures.yml b/.fixtures.yml index 51ae6fa..ad2fde2 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -18,6 +18,7 @@ fixtures: apache: "git://github.com/puppetlabs/puppetlabs-apache.git" portage: "git://github.com/gentoo/puppet-portage.git" thin: "git://github.com/danieldreier/puppet-thin.git" + puppetdb: "https://github.com/puppetlabs/puppetlabs-puppetdb.git" symlinks: puppet: "#{source_dir}" diff --git a/Modulefile b/Modulefile index c0bd5b0..5bc7276 100644 --- a/Modulefile +++ b/Modulefile @@ -17,3 +17,4 @@ dependency 'puppetlabs/apache', '>= 0.9.0' dependency 'gentoo/portage', '>= 2.1.0' dependency 'jfryman/nginx', '<= 0.0.10' dependency 'danieldreier/thin' +dependency 'puppetlabs/puppetdb', '>= 4.1.0' diff --git a/manifests/server.pp b/manifests/server.pp index 45ee261..aee636e 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -27,30 +27,31 @@ # } # class puppet::server ( - $modulepath = ['$confdir/modules/site', '$confdir/env/$environment/dist'], - $manifest = '$confdir/modules/site/site.pp', - $environmentpath = undef, - $config_version_cmd = '/usr/bin/git --git-dir $confdir/environments/$environment/.git rev-parse --short HEAD 2>/dev/null || echo', - $storeconfigs = undef, - $report = true, - $reports = ['store', 'https'], - $reporturl = "http://${::fqdn}/reports", - $reportfrom = undef, - $servertype = 'unicorn', - $serverssl_protos = undef, - $serverssl_ciphers = undef, - $ca = false, + $autosign = undef, $bindaddress = '0.0.0.0', + $ca = false, + $config_version_cmd = '/usr/bin/git --git-dir $confdir/environments/$environment/.git rev-parse --short HEAD 2>/dev/null || echo', + $dns_alt_names = undef, $enc = '', $enc_exec = '', - $servername = undef, $ensure = 'present', - $parser = undef, - $gentoo_use = $puppet::params::master_use, + $environmentpath = undef, $gentoo_keywords = $puppet::params::master_keywords, + $gentoo_use = $puppet::params::master_use, $manage_package = true, - $dns_alt_names = undef, - $autosign = undef, + $manifest = '$confdir/modules/site/site.pp', + $modulepath = ['$confdir/modules/site', '$confdir/env/$environment/dist'], + $parser = undef, + $manage_puppetdb = undef, + $report = true, + $reportfrom = undef, + $reports = ['store', 'https'], + $reporturl = "http://${::fqdn}/reports", + $servername = undef, + $serverssl_ciphers = undef, + $serverssl_protos = undef, + $servertype = 'unicorn', + $storeconfigs = undef, ) inherits puppet::params { $master = true @@ -104,9 +105,19 @@ # --- # Storeconfigs if $storeconfigs { + notify { 'storeconfigs is deprecated. Use manage_puppetdb setting.': } class { 'puppet::storeconfig': backend => $storeconfigs, } } + # enable basic puppetdb using the puppetlabs-puppetdb module + # this will also install postgresql + # for more detailed control over puppetdb settings, use the puppetdb + # module directly rather than having puppet-puppet include it. + if $manage_puppetdb == true { + include puppetdb + include puppetdb::master::config + } + } diff --git a/tests/unicorn_with_puppetdb.pp b/tests/unicorn_with_puppetdb.pp new file mode 100644 index 0000000..18a84d9 --- /dev/null +++ b/tests/unicorn_with_puppetdb.pp @@ -0,0 +1,18 @@ +class { '::puppet::server': + modulepath => [ + '$confdir/modules', + '$confdir/environments/$environment/modules/site', + '$confdir/environments/$environment/modules/site/dist', + '$confdir/environments/$environment/modules/site/dist', + ], + manage_puppetdb => true, + reporturl => "https://${::fqdn}/reports", + servertype => 'unicorn', + manifest => '$confdir/environments/$environment/site.pp', + ca => true, + reports => [ + 'https', + 'store', + 'puppetdb', + ], +}