Puppet Class: archlinux_workstation::cronie

Defined in:
manifests/cronie.pp

Overview

Install and run the cronie cron daemon. Per the Arch wiki cron entry, no cron daemon comes default with Arch.

Parameters:

  • mail_command (Variant[String, Undef]) (defaults to: undef)

    If defined, will run cronie with -m ${mail_command} to send mail via this command. See man 8 cron for more information.



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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'manifests/cronie.pp', line 10

class archlinux_workstation::cronie (
  Variant[String, Undef] $mail_command = undef,
) {

  if ! defined(Class['archlinux_workstation']) {
    fail('You must include the base archlinux_workstation class before using any subclasses')
  }

  package {'cronie':
    ensure => present,
  }

  if $mail_command {
    exec {'cronie-daemon-reload':
      command     => '/usr/bin/systemctl daemon-reload',
      refreshonly => true,
    }

    file {'cronie.service.d':
      ensure  => directory,
      path    => '/usr/lib/systemd/system/cronie.service.d',
      owner   => 'root',
      group   => 'root',
      mode    => '0755',
      require => Package['cronie'],
    }

    $mail_cmd_content = "# Managed by Puppet - archlinux_workstation::cronie class
[Service]
ExecStart=
ExecStart=/usr/bin/crond -n -m ${mail_command}
"

    file {'cronie_mail_command.conf':
      ensure  => present,
      path    => '/usr/lib/systemd/system/cronie.service.d/cronie_mail_command.conf',
      owner   => 'root',
      group   => 'root',
      mode    => '0644',
      require => File['cronie.service.d'],
      content => $mail_cmd_content,
      notify  => [Exec['cronie-daemon-reload'], Service['cronie']],
    }

    $svc_require = [Package['cronie'], File['cronie_mail_command.conf'], Exec['cronie-daemon-reload']]
  } else {
    $svc_require = [Package['cronie']]
  }

  service {'cronie':
    ensure  => running,
    enable  => true,
    require => $svc_require,
  }

}