Defined Type: profile::script
- Defined in:
- manifests/script.pp
Overview
Define profile::script
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 |
# File 'manifests/script.pp', line 5
define profile::script (
$priority = '',
$autoexec = false,
$source = '',
$content = '',
$owner = 'root',
$group = 'root',
$mode = '0755' ) {
include profile
require profile::params
$safe_name = regsubst($name, '/', '_', 'G')
$bool_autoexec = any2bool($autoexec)
$manage_file_source = $source ? {
'' => undef,
default => $source,
}
$manage_file_content = $content ? {
'' => undef,
default => $content,
}
file { "profile_${priority}_${safe_name}":
path => "${profile::config_dir}/${priority}-${safe_name}.sh",
mode => $mode,
owner => $owner,
group => $group,
content => $manage_file_content,
source => $manage_file_source,
audit => $profile::manage_audit,
}
if $bool_autoexec == true {
exec { "profile_${priority}_${safe_name}":
command => "sh ${profile::config_dir}/${priority}-${safe_name}.sh",
refreshonly => true,
subscribe => File[ "profile_${priority}_${safe_name}" ],
path => '/usr/bin:/bin:/usr/sbin:/sbin',
}
}
}
|