Puppet Class: puppetdb::master::routes

Inherits:
puppetdb::params
Defined in:
manifests/master/routes.pp

Summary

manages the routes configuration file on the master

Overview

Parameters:

  • puppet_confdir (Any) (defaults to: $puppetdb::params::puppet_confdir)
  • masterless (Any) (defaults to: $puppetdb::params::masterless)
  • routes (Any) (defaults to: undef)


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'manifests/master/routes.pp', line 4

class puppetdb::master::routes (
  $puppet_confdir = $puppetdb::params::puppet_confdir,
  $masterless     = $puppetdb::params::masterless,
  $routes         = undef,
) inherits puppetdb::params {
  if $masterless {
    $routes_real = {
      'apply' => {
        'catalog' => {
          'terminus' => 'compiler',
          'cache'    => 'puppetdb',
        },
        'facts'   => {
          'terminus' => 'facter',
          'cache'    => 'puppetdb_apply',
        },
      },
    }
  } elsif $routes {
    $routes_real = $routes
  } else {
    if (defined('$serverversion')) and (versioncmp($serverversion, '7.0') >= 0) {
      $default_fact_cache = 'json'
    } else {
      $default_fact_cache = 'yaml'
    }
    $routes_real = {
      'master' => {
        'facts' => {
          'terminus' => 'puppetdb',
          'cache'    => $default_fact_cache,
        },
      },
    }
  }

  # TODO: this will overwrite any existing routes.yaml;
  #  to handle this properly we should just be ensuring
  #  that the proper settings exist, but to do that we'd need
  #  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,
    content => template('puppetdb/routes.yaml.erb'),
    mode    => '0644',
  }
}