Defined Type: systemd::timer

Defined in:
modules/systemd/manifests/timer.pp

Overview

Parameters:

  • timer_intervals (Array[Systemd::Timer::Schedule, 1])
  • unit_name (String) (defaults to: "${title}.service")
  • ensure (Wmflib::Ensure) (defaults to: 'present')
  • splay (Integer) (defaults to: 0)
  • accuracy (Systemd::Timer::Interval) (defaults to: '15sec')


26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'modules/systemd/manifests/timer.pp', line 26

define systemd::timer(
    Array[Systemd::Timer::Schedule, 1] $timer_intervals,
    String $unit_name="${title}.service",
    Wmflib::Ensure $ensure = 'present',
    Integer $splay = 0,
    Systemd::Timer::Interval $accuracy = '15sec',
) {
    if $ensure == 'present' {
        $timer_intervals.each |$schedule| {
            # Each Schedule has either an Interval (which is already validated by
            # regex) or a Datetime.
            $interval = $schedule['interval']
            if $interval !~ Systemd::Timer::Interval {
                generate('/usr/bin/systemd-analyze', 'calendar', $interval)
            }
        }
    }

    # Timer service
    systemd::service { $title:
        ensure    => $ensure,
        unit_type => 'timer',
        content   => template('systemd/systemd.timer.erb'),
        require   => Systemd::Unit[$unit_name],
    }
}