Puppet Class: stdlib::manage

Defined in:
vendor_modules/stdlib/manifests/manage.pp

Summary

A simple place to define trivial resources

Overview

Sometimes your systems require a single simple resource. It can feel unnecessary to create a module for a single resource. There are a number of possible patterns to generate trivial resource definitions. This is an attempt to create a single clear method for uncomplicated resources. There is __limited__ support for `before`, `require`, `notify`, and `subscribe`.

Examples:

class { 'stdlib::manage':
    'create_resources' => {
      'file' => {
        '/etc/motd.d/hello' => {
          'content' => 'I say Hi',
          'notify' => 'Service[sshd]',
        }
      },
      'package' => {
        'example' => {
          'ensure' => 'installed',
          'subscribe' => ['Service[sshd]', 'Exec[something]'],
        }
      }
    }
stdlib::manage::create_resources:
  file:
    '/etc/motd.d/hello':
      content: I say Hi
      notify: 'Service[sshd]'
  package:
    example:
      ensure: installed
      subscribe:
        - 'Service[sshd]'
        - 'Exec[something]'

Parameters:

  • create_resources (Hash[String, Hash]) (defaults to: {})

    A hash of resources to create NOTE: functions, such as `template` or `epp`, are not evaluated.



44
45
46
47
48
49
50
51
52
# File 'vendor_modules/stdlib/manifests/manage.pp', line 44

class stdlib::manage (
  Hash[String, Hash] $create_resources = {}
) {
  $create_resources.each |$type, $resources| {
    $resources.each |$title, $attributes| {
      create_resources($type, { $title => $attributes })
    }
  }
}