Puppet Class: puppet::storeconfig

Defined in:
manifests/storeconfig.pp

Overview

Class: puppet::storeconfig

This class installs and configures Puppet’s stored configuration capability

Parameters:

Actions:

Requires:

Sample Usage:

Parameters:

  • backend (Any) (defaults to: '')
  • dbuser (Any) (defaults to: 'puppet')
  • dbpassword (Any) (defaults to: '')
  • dbserver (Any) (defaults to: 'localhost')
  • dbsocket (Any) (defaults to: '')


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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'manifests/storeconfig.pp', line 13

class puppet::storeconfig (
    $backend    = '',
    $dbuser     = 'puppet',
    $dbpassword = '',
    $dbserver   = 'localhost',
    $dbsocket   = ''
) {

  include puppet
  include puppet::params

  #$puppet::storeconfigs = 'true' # called from puppet::server only if storeconfigs is on

  Ini_setting {
    ensure  => 'present',
    section => 'master',
    path    => $puppet::params::puppet_conf,
  }

  # if no backend was selected
  $thin_enable = $backend ? {
    ''      => true,
    default => false,
  }
  $thin_ensure = $backend ? {
    ''      => 'present',
    default => 'absent',
  }

  # use thin_storageconfigs
  ini_setting {
    'storeconfigs':
      setting => 'storeconfigs',
      value   => $thin_enable;
    'thin_storeconfigs':
      ensure  => $thin_ensure,
      setting => 'thin_storeconfigs',
      value   => $thin_enable;
  }

  case $backend {
    'mysql','postgresql','sqlite': {

      # this is not pretty, and could be put into params..

      $package_name = $::operatingsystem ? {
        'Debian' => 'libactiverecord-ruby',
        default  => 'activerecord',
      }
      $package_provider = $::operatingsystem ? {
        'Debian' => 'apt',
        'Darwin' => 'macports',
        default  => 'gem',
      }

      package { 'gem-activerecord':
        name     => $package_name,
        provider => $package_provider,
      }
    }
  }

  case $backend {
    'sqlite3': {
      include puppet::storeconfig::sqlite
    }
    'mysql': {
      class { 'puppet::storeconfig::mysql':
          dbuser     => $dbuser,
          dbpassword => $dbpassword,
      }
    }
    'postgresql': {
      class { 'puppet::storeconfig::postgresql':
          dbuser     => $dbuser,
          dbpassword => $dbpassword,
      }
    }
    'puppetdb': {
      class {'::puppet::storeconfig::puppetdb': }
    }
    default: { err('Target storeconfigs backend "$backend" not implemented') }
  }
}