Defined Type: puppet::masterenv

Defined in:
manifests/masterenv.pp

Overview

Define: puppet::masterenv

This define configures puppet master environment

Parameters:

['modulepath']         - The modulepath for the environment
['manifest']           - The manifest for the environmen

Actions:

  • Add enviroments to the puppet master

Requires:

  • Inifile

Sample Usage:

puppet::masterenv{ 'dev':
    modulepath             => '/etc/puppet/modules'
    manifest               => 'dev'
}

Parameters:

  • modulepath (Any)
  • manifest (Any)
  • puppet_conf (Any) (defaults to: $::puppet::params::puppet_conf)
  • environments (Any) (defaults to: $::puppet::master::environments)
  • environmentpath (Any) (defaults to: $::puppet::master::environmentpath)


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
# File 'manifests/masterenv.pp', line 21

define  puppet::masterenv (
  $modulepath,
  $manifest,
  $puppet_conf = $::puppet::params::puppet_conf,
  $environments = $::puppet::master::environments,
  $environmentpath = $::puppet::master::environmentpath
) {

  case $environments {
    'directory': {
      $path = "${environmentpath}/${name}/environment.conf"
      $section = ''
      file { "${environmentpath}/${name}":
        ensure => directory,
        before => [Ini_setting["masterenvmodule${name}"],Ini_setting["masterenvmanifest${name}"]],
      }
    }
    default: {
      $path = $puppet_conf
      $section = $name
    }
  }

  Ini_setting {
      path    => $path,
      section => $section,
      require => [File[$puppet_conf], Class['puppet::master']],
      notify  => Service['httpd'],
  }

  ini_setting {
    "masterenvmodule${name}":
      ensure  => present,
      setting => 'modulepath',
      value   => $modulepath;

    "masterenvmanifest${name}":
      ensure  => present,
      setting => 'manifest',
      value   => $manifest;
  }
}