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
|
# File 'manifests/aws/cli/script.pp', line 2
define psick::aws::cli::script (
String $template,
String $ensure = 'present',
Boolean $autorun = true,
String $destination_dir = '/var/tmp',
Variant[Undef,String] $region = undef,
String $command = '', # lint:ignore:params_empty_string_assignment
) {
$script_path = "${destination_dir}/${title}"
$exec_command = $command ? {
# '' => "${script_path} || rm ${script_path}",
'' => $script_path,
default => $command,
}
file { $script_path:
ensure => $ensure,
path => $script_path,
mode => '0750',
content => template($template),
}
if $autorun {
exec { "aws script ${title}":
command => $exec_command,
refreshonly => true,
logoutput => true,
subscribe => File[$script_path],
}
}
}
|