Defined Type: kerberos::systemd_timer

Defined in:
modules/kerberos/manifests/systemd_timer.pp

Overview

Define: kerberos::systemd_timer

This used to be its own define, which got abstracted to the more general systemd::timer::job define. This is a wrapper to allow executing kinit before executing commands.

description

Description to place in the systemd unit.

command

Command to be executed periodically.

interval

Systemd interval to use. Format: DayOfWeek Year-Month-Day Hour:Minute:Second

user

User that runs the Systemd unit. Default: 'analytics'

environment

Hash containing 'Environment=' related values to insert in the Systemd unit.

monitoring_enabled

Periodically check the last execution of the unit and alarm if it ended up in a failed state. Default: true

monitoring_contact_groups

The monitoring's contact group to send the alarm to. Default: analytics

logfile_basedir

Base directory where to store the syslog output of the running unit. Default: “/var/log/”

logfile_name

The filename of the file storing the syslog output of the running unit. If set to undef, it avoids the deployment of rsyslog/logrotate rules (relying only on journald). Default: undef

logfile_owner

The user that owns the logfile. Default: 'hdfs'

logfile_group

The group that owns the logfile. Default: 'hdfs'

logfile_perms

The UNIX file permissions to set on the log file. Check systemd::syslog for more info about the available options. Default: 'all'

syslog_force_stop

Force logs to be written into the logfile but not in syslog/daemon.log. This is particularly useful for units that need to log a lot of information, since it prevents a duplication of space consumed on disk. Default: true

syslog_match_startswith

If true, all syslog programnames that start with the service_name will be logged to the output log file. Else, only service_names that match exactly will be logged. Default: true

syslog_identifier

Adds the SyslogIdentifier parameter to the systemd unit to override the default behavior, namely using the program name. This is particularly useful when multiple timers are scheduled using the same program but with different parameters. Without an explicit SyslogIdentifier in fact they would end up sharing the same identifier and rsyslog rules wouldn't work anymore. Default: undef

use_kerberos

Force a kinit before executing the command to properly authenticate via Kerberos. Default: false

slice

Run the systemd timer's service unit under a specific slice. By default the service unit will run under the system.slice. Default: undef (do not add any Slice setting to the unit)

Parameters:

  • description (Any)
  • command (Any)
  • interval (Any)
  • user (Any) (defaults to: 'analytics')
  • environment (Any) (defaults to: {})
  • monitoring_enabled (Any) (defaults to: true)
  • monitoring_contact_groups (Any) (defaults to: 'analytics')
  • logfile_basedir (Any) (defaults to: '/var/log/')
  • logfile_name (Any) (defaults to: undef)
  • logfile_owner (Any) (defaults to: 'analytics')
  • logfile_group (Any) (defaults to: 'analytics')
  • logfile_perms (Any) (defaults to: 'all')
  • syslog_force_stop (Any) (defaults to: true)
  • syslog_match_startswith (Any) (defaults to: true)
  • use_kerberos (Any) (defaults to: false)
  • syslog_identifier (Any) (defaults to: undef)
  • ensure (Any) (defaults to: present)
  • slice (Optional[Pattern[/\w+\.slice/]]) (defaults to: undef)


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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'modules/kerberos/manifests/systemd_timer.pp', line 90

define kerberos::systemd_timer(
    $description,
    $command,
    $interval,
    $user = 'analytics',
    $environment = {},
    $monitoring_enabled = true,
    $monitoring_contact_groups = 'analytics',
    $logfile_basedir = '/var/log/',
    $logfile_name = undef,
    $logfile_owner = 'analytics',
    $logfile_group = 'analytics',
    $logfile_perms = 'all',
    $syslog_force_stop = true,
    $syslog_match_startswith = true,
    $use_kerberos = false,
    $syslog_identifier = undef,
    $ensure = present,
    Optional[Pattern[/\w+\.slice/]] $slice = undef,
) {

    require ::kerberos::wrapper

    if $use_kerberos {
        $wrapper = "${kerberos::wrapper::kerberos_run_command_script} ${user} "
    } else {
        $wrapper = ''
    }

    $logging = $logfile_name ? {
        undef   => false,
        default => true
    }
    systemd::timer::job { $title:
        ensure                    => $ensure,
        description               => $description,
        command                   => "${wrapper}${command}",
        interval                  => {
            'start'    => 'OnCalendar',
            'interval' => $interval
        },
        user                      => $user,
        environment               => $environment,
        monitoring_enabled        => $monitoring_enabled,
        monitoring_contact_groups => $monitoring_contact_groups,
        logging_enabled           => $logging,
        logfile_basedir           => $logfile_basedir,
        logfile_name              => $logfile_name,
        logfile_owner             => $logfile_owner,
        logfile_group             => $logfile_group,
        logfile_perms             => $logfile_perms,
        syslog_identifier         => $syslog_identifier,
        syslog_match_startswith   => $syslog_match_startswith,
        syslog_force_stop         => $syslog_force_stop,
        slice                     => $slice,
    }
}