Defined Type: psick::profile::script
- Defined in:
- manifests/profile/script.pp
Overview
Define psick::profile::script Derived from github.com/example42/puppet-profile This define creates a single script in /etc/profile.d
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 |
# File 'manifests/profile/script.pp', line 5
define psick::profile::script (
Enum['present','absent'] $ensure = 'present',
Boolean $autoexec = false,
String $source = '', # lint:ignore:params_empty_string_assignment
String $content = '', # lint:ignore:params_empty_string_assignment
String $template = '', # lint:ignore:params_empty_string_assignment
String $config_dir = '/etc/profile.d',
String $owner = 'root',
String $group = 'root',
String $mode = '0755'
) {
$safe_name = regsubst($name, '/', '_', 'G')
$manage_file_source = $source ? {
'' => undef,
default => $source,
}
if !empty($content) {
$manage_file_content = $content
} elsif !empty($template) {
$manage_file_content = psick::template($template)
} else {
$manage_file_content = undef
}
file { "profile_${safe_name}":
ensure => $ensure,
path => "${config_dir}/${safe_name}.sh",
mode => $mode,
owner => $owner,
group => $group,
content => $manage_file_content,
source => $manage_file_source,
}
if $autoexec and $ensure == 'present' {
exec { "profile_${safe_name}":
command => "sh ${config_dir}/${safe_name}.sh",
refreshonly => true,
subscribe => File["profile_${safe_name}"],
path => '/usr/bin:/bin:/usr/sbin:/sbin',
}
}
}
|