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
|
# File 'manifests/resource/snippet.pp', line 14
define nginx::resource::snippet (
String[1] $raw_content,
Enum['absent', 'present'] $ensure = 'present',
String $owner = $nginx::global_owner,
String $group = $nginx::global_group,
Stdlib::Filemode $mode = $nginx::global_mode,
) {
if ! defined(Class['nginx']) {
fail('You must include the nginx base class before using any defined resources')
}
$name_sanitized = regsubst($name, ' ', '_', 'G')
$config_file = "${nginx::snippets_dir}/${name_sanitized}.conf"
concat { $config_file:
ensure => $ensure,
owner => $owner,
group => $group,
mode => $mode,
notify => Class['nginx::service'],
require => File[$nginx::snippets_dir],
tag => 'nginx_config_file',
}
concat::fragment { "snippet-${name_sanitized}-header":
target => $config_file,
content => epp("${module_name}/snippet/snippet_header.epp", { 'raw_content' => $raw_content }),
order => '001',
}
}
|