aboutsummaryrefslogtreecommitdiff
path: root/modules/base_installation/manifests/cronie.pp
blob: 7552b4dae4286ab30ba655918373f36431a319bd (plain) (blame)
1
2
3
4
5
6
7
8
9
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
class base_installation::cronie inherits base_installation {
  ensure_packages(['cronie'])

  Package["cronie"] -> Cron::Job <| |>
  Package["cronie"] -> Cron::Job::Multiple <| |>
  Package["cronie"] -> Cron::Daily <| |>

  unless empty($base_installation::puppet_code_path) {
    file { 'post-hook':
      ensure  => file,
      path    => "$base_installation::puppet_code_path/.git/hooks/post-merge",
      source  => 'puppet:///modules/base_installation/cronie/puppet-post-merge',
      mode    => '0755',
      owner   => root,
      group   => root,
    }
    cron::job { 'puppet-pull-apply':
      ensure      => present,
      command     => "cd $base_installation::puppet_code_path ; /usr/bin/git pull",
      user        => root,
      minute      => '15,45',
      require     => File['post-hook'],
      description => "Pull git and apply puppet changes",
    }
    cron::job::multiple { 'puppet-apply':
      ensure => present,
      environment => [ 'MAILTO=""' ],
      jobs   => [
        {
          command     => "cd $base_installation::puppet_code_path ; /usr/local/sbin/puppet_apply $base_installation::puppet_code_path/manifests/site.pp",
          user        => root,
          minute      => '*/20',
          description => "Re-apply puppet changes regularly",
        },
        {
          command     => "cd $base_installation::puppet_code_path ; /usr/local/sbin/puppet_apply $base_installation::puppet_code_path/manifests/site.pp",
          user        => root,
          special     => "reboot",
          description => "Re-apply puppet changes at reboot",
        }
      ]
    }

    cron::daily { 'pacman_keys':
      ensure      => present,
      command     => "pacman-key --populate archlinux",
      user        => root,
      minute      => "0",
      hour        => "1",
      description => "Populate pacman keys",
    }
  }
}