Puppet Class: tlog::rec_session
- Defined in:
- manifests/rec_session.pp
Overview
Configure ‘tlog-rec-session`
This is pulled out from the main ‘tlog` class because of the rapidly moving nature of the project. Having this decoupled will allow us to refactor as necessary as the software progresses.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'manifests/rec_session.pp', line 48
class tlog::rec_session (
Tlog::RecSessionConf $options,
Hash $custom_options = {},
Boolean $shell_hook = true,
Array[String[1]] $shell_hook_users = [ 'root' ],
Stdlib::Absolutepath $shell_hook_users_file = '/etc/security/tlog.users',
Stdlib::Absolutepath $shell_hook_cmd = '/usr/bin/tlog-rec-session'
) {
simplib::assert_metadata($module_name)
include 'tlog'
$_file_defaults = {
owner => 'root',
group => 'root',
mode => '0644'
}
# Ensure the file resource exists if we are using a file writer
if $options['writer'] == 'file' {
$_tlog_output_file_opts = {
ensure => 'file',
owner => 'tlog',
group => 'tlog',
mode => '0640',
}
ensure_resource('file', $options['file']['path'], $_tlog_output_file_opts)
}
file { '/etc/tlog/tlog-rec-session.conf':
ensure => 'file',
content => sprintf("%s\n", to_json(deep_merge($options, $custom_options))),
* => $_file_defaults
}
$_hook_file_ensure = $shell_hook ? {
true => 'file',
default => 'absent'
}
file { '/etc/profile.d/00-simp-tlog.sh':
ensure => $_hook_file_ensure,
content => epp("${module_name}/etc/profile.d/tlog.sh.epp",
{
'users_file' => $shell_hook_users_file,
'app_path' => $shell_hook_cmd
}
),
* => $_file_defaults
}
file { '/etc/profile.d/00-simp-tlog.csh':
ensure => $_hook_file_ensure,
content => epp("${module_name}/etc/profile.d/tlog.csh.epp",
{
'users_file' => $shell_hook_users_file,
'app_path' => $shell_hook_cmd
}
),
* => $_file_defaults
}
file { $shell_hook_users_file:
ensure => $_hook_file_ensure,
content => sprintf("%s\n", join($shell_hook_users, "\n")),
* => $_file_defaults
}
Class['tlog::install'] -> File['/etc/tlog/tlog-rec-session.conf']
if $shell_hook {
Class['tlog::install'] -> File['/etc/profile.d/00-simp-tlog.sh']
Class['tlog::install'] -> File['/etc/profile.d/00-simp-tlog.csh']
Class['tlog::install'] -> File[$shell_hook_users_file]
}
}
|