Defined Type: systemd::unit::timer

Defined in:
manifests/unit/timer.pp

Overview

This function manages a systemd timer unit.

Parameters:

description    - what this is all about
on_*           - various flavours of timer periods (see systemd.timer(5))
start_unit     - systemd unit to activate when timer goes off
*_options      - other systemd directives   (see systemd::unit)

Parameters:

  • description (String)
  • on_active (Optional[String]) (defaults to: undef)
  • on_boot (Optional[String]) (defaults to: undef)
  • on_startup (Optional[String]) (defaults to: undef)
  • on_unitactive (Optional[String]) (defaults to: undef)
  • on_unitinactive (Optional[String]) (defaults to: undef)
  • start_unit (Optional[String]) (defaults to: undef)
  • wantedby (Optional[Variant[[Array[String],String]]]) (defaults to: ['timers.target'])
  • ensure (String) (defaults to: 'present')
  • unit_name (String) (defaults to: $title)
  • unit_options (Hash) (defaults to: {})
  • install_options (Hash) (defaults to: {})
  • timer_options (Hash) (defaults to: {})
  • manage_unitstatus (Boolean) (defaults to: true)
  • unit_ensure (Enum['running','stopped']) (defaults to: 'running')
  • unit_enable (Boolean) (defaults to: true)


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
49
50
51
52
53
54
55
56
57
# File 'manifests/unit/timer.pp', line 12

define systemd::unit::timer (
  String                                    $description,
  Optional[String]                          $on_active = undef,
  Optional[String]                          $on_boot = undef,
  Optional[String]                          $on_startup = undef,
  Optional[String]                          $on_unitactive = undef,
  Optional[String]                          $on_unitinactive = undef,
  Optional[String]                          $start_unit = undef,

  Optional[Variant[[Array[String],String]]] $wantedby = ['timers.target'],
  String                                    $ensure = 'present',
  String                                    $unit_name = $title,

  Hash                                      $unit_options    = {},
  Hash                                      $install_options = {},
  Hash                                      $timer_options   = {},

  Boolean                                   $manage_unitstatus = true,
  Enum['running','stopped']                 $unit_ensure = 'running',
  Boolean                                   $unit_enable = true,
) {

  include ::systemd

  systemd::unit { "${title}::timer":
    ensure            => $ensure,
    unit_name         => $unit_name,
    unit_type         => 'timer',

    manage_unitstatus => $manage_unitstatus,
    unit_ensure       => $unit_ensure,
    unit_enable       => $unit_enable,

    unit_options      => $unit_options + { 'Description' => $description, },
    install_options   => $install_options + { 'WantedBy' => $wantedby, },
    type_options      => $timer_options + {
      'OnActiveSec'       => $on_active,
      'OnBootSec'         => $on_active,
      'OnStartupSec'      => $on_active,
      'OnUnitActiveSec'   => $on_active,
      'OnUnitInactiveSec' => $on_active,
      'Unit'              => $start_unit
    },
  }

}