From 32decebb04446dc928256988868962f9fd9f5730 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Dal=C3=A9n?= Date: Wed, 14 May 2014 14:06:48 +0200 Subject: [PATCH] Allow more flexible routes configuration --- README.md | 13 +++++++++++++ files/routes.yaml | 6 ------ manifests/master/routes.pp | 12 ++++++++++-- templates/routes.yaml.erb | 3 +++ 4 files changed, 26 insertions(+), 8 deletions(-) delete mode 100644 files/routes.yaml create mode 100644 templates/routes.yaml.erb diff --git a/README.md b/README.md index 285e2f13..365d8c5e 100644 --- a/README.md +++ b/README.md @@ -431,6 +431,19 @@ Configures the puppet master to use PuppetDB as the facts terminus. *WARNING*: t puppet_confdir => '/etc/puppet' } +The optional parameter routes can be used to specify a custom route configuration. For example to configure routes for masterless puppet. + + class { 'puppetdb::master::routes': + routes => { + 'apply' => { + 'facts' => { + 'terminus' => 'facter', + 'cache' => 'puppetdb_apply', + } + } + } + } + **puppetdb::master::storeconfigs** Configures the puppet master to enable storeconfigs and to use PuppetDB as the storeconfigs backend. diff --git a/files/routes.yaml b/files/routes.yaml deleted file mode 100644 index 82eb6796..00000000 --- a/files/routes.yaml +++ /dev/null @@ -1,6 +0,0 @@ -# This file was automatically generated by the puppetdb module. - -master: - facts: - terminus: puppetdb - cache: yaml diff --git a/manifests/master/routes.pp b/manifests/master/routes.pp index bb516bb0..8d01f4c9 100644 --- a/manifests/master/routes.pp +++ b/manifests/master/routes.pp @@ -2,6 +2,14 @@ # details. class puppetdb::master::routes( $puppet_confdir = $puppetdb::params::puppet_confdir, + $routes = { + 'master' => { + 'facts' => { + 'terminus' => 'puppetdb', + 'cache' => 'yaml', + } + } + } ) inherits puppetdb::params { # TODO: this will overwrite any existing routes.yaml; @@ -10,7 +18,7 @@ # to parse the yaml file and rewrite it, dealing with indentation issues etc. # I don't think there is currently a puppet module or an augeas lens for this. file { "${puppet_confdir}/routes.yaml": - ensure => file, - source => 'puppet:///modules/puppetdb/routes.yaml', + ensure => file, + content => template('puppetdb/routes.yaml.erb'), } } diff --git a/templates/routes.yaml.erb b/templates/routes.yaml.erb new file mode 100644 index 00000000..d2673cd7 --- /dev/null +++ b/templates/routes.yaml.erb @@ -0,0 +1,3 @@ +# This file was automatically generated by the puppetdb module. + +<%= @routes.to_yaml %>