aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorMichael Scherer <misc@mageia.org>2012-02-10 19:05:33 +0000
committerMichael Scherer <misc@mageia.org>2012-02-10 19:05:33 +0000
commit82138c7590284c843f54212d946e6debde7fa6dc (patch)
treee4c861680379ff1ed1217ee150a237d8ac569be0 /modules
parent5c53dd98d51378c8aab0c8d5bfece2b075191edb (diff)
downloadpuppet-82138c7590284c843f54212d946e6debde7fa6dc.tar
puppet-82138c7590284c843f54212d946e6debde7fa6dc.tar.gz
puppet-82138c7590284c843f54212d946e6debde7fa6dc.tar.bz2
puppet-82138c7590284c843f54212d946e6debde7fa6dc.tar.xz
puppet-82138c7590284c843f54212d946e6debde7fa6dc.zip
split stored_config in a separate class, and refactor the configuration.
This will ease a switch to postgresql once I found how to solve the issues of bootstrapping it ( for automated reinstallation )
Diffstat (limited to 'modules')
-rw-r--r--modules/puppet/manifests/client.pp1
-rw-r--r--modules/puppet/manifests/master.pp2
-rw-r--r--modules/puppet/manifests/stored_config.pp27
-rw-r--r--modules/puppet/templates/db_config.pp10
-rw-r--r--modules/puppet/templates/puppet.conf9
5 files changed, 43 insertions, 6 deletions
diff --git a/modules/puppet/manifests/client.pp b/modules/puppet/manifests/client.pp
index 55894d9b..6fa166d2 100644
--- a/modules/puppet/manifests/client.pp
+++ b/modules/puppet/manifests/client.pp
@@ -1,4 +1,5 @@
class puppet::client {
+ include puppet::stored_config
package { 'puppet': }
file { '/etc/puppet/puppet.conf':
diff --git a/modules/puppet/manifests/master.pp b/modules/puppet/manifests/master.pp
index 5975b700..454c914f 100644
--- a/modules/puppet/manifests/master.pp
+++ b/modules/puppet/manifests/master.pp
@@ -3,7 +3,7 @@ class puppet::master {
include puppet::queue
# rails and sqlite3 are used for stored config
- package { ['ruby-sqlite3', 'puppet-server', 'ruby-rails']: }
+ package { 'puppet-server': }
service { 'puppetmaster':
subscribe => [Package['puppet-server'],
diff --git a/modules/puppet/manifests/stored_config.pp b/modules/puppet/manifests/stored_config.pp
new file mode 100644
index 00000000..9a7cb534
--- /dev/null
+++ b/modules/puppet/manifests/stored_config.pp
@@ -0,0 +1,27 @@
+class puppet::stored_config {
+# TODO uncomment when the following problem have been fixed
+# - how to bootstrap the installation of the infrastructure ( since we use
+# stored_config for postgresql::remote_db_and_user, we need to have a sqlite3
+# database first and then declare the database, and then switch to it )
+# - how do we decide when we get sqlite3 ( for small test servers ) and
+# when do we decide to get the real pgsql server ( for production setup )
+#
+# if ($::environment == 'production') {
+# # FIXME not really elegant, but we do not have much choice
+# # this make servers not bootstrapable for now
+# $pgsql_password = extlookup('puppet_pgsql','x')
+#
+# postgresql::remote_db_and_user { 'bugs':
+# description => 'Puppet database',
+# password => $pgsql_password,
+# }
+#
+# $database = 'pg'
+# } else {
+ $database = 'sqlite3'
+# }
+#
+ package { ["ruby-$database", 'ruby-rails']: }
+
+ $db_config = template('puppet/db_config.pp')
+}
diff --git a/modules/puppet/templates/db_config.pp b/modules/puppet/templates/db_config.pp
new file mode 100644
index 00000000..337a5043
--- /dev/null
+++ b/modules/puppet/templates/db_config.pp
@@ -0,0 +1,10 @@
+<%- if database == 'sqlite3' -%>
+ dbadapter = sqlite3
+ dblocation = /var/lib/puppet/storeconfigs.db
+<%- else -%>
+ dbadapter = postgresql
+ dbuser = puppet
+ dbpassword = <%= pgsql_password %>
+ dbserver = pgsql.<%= domain %>
+ dbname = puppet
+<%- end -%>
diff --git a/modules/puppet/templates/puppet.conf b/modules/puppet/templates/puppet.conf
index 18b35166..2be6e45d 100644
--- a/modules/puppet/templates/puppet.conf
+++ b/modules/puppet/templates/puppet.conf
@@ -1,3 +1,4 @@
+<% db_config = scope.lookupvar('puppet::stored_config::db_config') %>
[main]
# The Puppet log directory.
# The default value is '$vardir/log'.
@@ -14,8 +15,7 @@
modulepath = $confdir/modules:$confdir/deployment:$confdir/external:/usr/share/puppet/modules
queue_type = stomp
queue_source = stomp://localhost:61613
- dbadapter = sqlite3
- dblocation = /var/lib/puppet/storeconfigs.db
+<%= db_config %>
[master]
certname = puppet.<%= domain %>
@@ -28,10 +28,9 @@
# Never remove this:
# Store config is used to populate others configs
storeconfigs = true
- dbadapter = sqlite3
- dblocation = /var/lib/puppet/storeconfigs.db
+ async_storeconfigs = true
+<%= db_config %>
- async_storeconfigs = true
[agent]
server = puppet.<%= domain %>