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
|
# File 'manifests/conf.pp', line 16
define openondemand::conf (
Optional[String] $source = undef,
Optional[String] $content = undef,
Optional[String] $content_template = undef,
Optional[Hash] $data = undef,
Boolean $template = false,
Optional[String] $filename = undef,
) {
if ! $source and ! $content and ! $content_template and ! $data {
fail('Defined type openondemand::conf: Must define either source, content, content_template or data')
}
if $template {
$extension = 'yml.erb'
} else {
$extension = 'yml'
}
$_filename = pick($filename, "${name}.${extension}")
if $data {
$_content = join([
'# File managed by Puppet - DO NOT EDIT',
to_yaml($data),
'',
], "\n")
} elsif $content_template {
$_content = template($content_template)
} else {
$_content = $content
}
include openondemand
file { "/etc/ood/config/ondemand.d/${_filename}":
ensure => 'file',
owner => 'root',
group => 'root',
mode => '0644',
content => $_content,
source => $source,
notify => Class['openondemand::service'],
}
}
|