-
Notifications
You must be signed in to change notification settings - Fork 575
Expand file tree
/
Copy pathmanage.pp
More file actions
52 lines (52 loc) · 1.5 KB
/
manage.pp
File metadata and controls
52 lines (52 loc) · 1.5 KB
1
2
3
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
52
# @summary A simple place to define trivial resources
#
# 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`.
#
# @param create_resources
# A hash of resources to create
# NOTE: functions, such as `template` or `epp`, are not evaluated.
#
# @example
# 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]'],
# }
# }
# }
#
# @example
# 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]'
class stdlib::manage (
Hash[String, Hash] $create_resources = {}
) {
$create_resources.each |$type, $resources| {
$resources.each |$title, $attributes| {
create_resources($type, { $title => $attributes })
}
}
}