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
53
54
55
56
57
58
59
60
61
62
63
|
# File 'manifests/group.pp', line 13
define pdsh::group (
Variant[Array, String] $aliases = [],
Variant[Array, String] $members = [],
) {
if $aliases =~ String {
$_aliases = [$aliases]
} else {
$_aliases = $aliases
}
if $members =~ String {
$_members = [$members]
} else {
$_members = $members
}
include pdsh
if ! $pdsh::support_dsh {
fail('Defined type pdsh::group: Must set pdsh::support_dsh to true to use this feature')
}
concat { "${pdsh::dsh_group_dir}/${name}":
owner => 'root',
group => 'root',
mode => '0644',
require => File[$pdsh::dsh_group_dir],
}
concat::fragment { "pdsh-group-${name}-header":
target => "${pdsh::dsh_group_dir}/${name}",
content => "# Managed by Puppet\n\n",
order => '01',
}
$_aliases.each |$alias| {
file { "${pdsh::dsh_group_dir}/${alias}":
ensure => 'link',
target => $name,
}
}
$_members.each |$member| {
concat::fragment { "pdsh-${name}-member-${member}":
target => "${pdsh::dsh_group_dir}/${name}",
content => "${member}\n",
order => '10',
}
}
}
|