Puppet Class: package_updates

Defined in:
manifests/init.pp

Overview

Parameters:

  • minute (Any) (defaults to: undef)
  • hour (Any) (defaults to: 3)
  • month (Any) (defaults to: undef)
  • monthday (Any) (defaults to: undef)
  • weekday (Any) (defaults to: undef)


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
# File 'manifests/init.pp', line 1

class package_updates (
  $minute   = undef,
  $hour     = 3,
  $month    = undef,
  $monthday = undef,
  $weekday  = undef,
) {
  if $::kernel != 'windows' {

    # This is dumb but we must count on this directory existing
    # and it may be managed somewhere else
    exec { 'create facts.d':
      command => 'mkdir -p /etc/puppetlabs/facter/facts.d/',
      path    => '/bin:/usr/bin',
      creates => '/etc/puppetlabs/facter/facts.d/',
    }

    cron { 'package_updates':
      command  => 'puppet package updates --render-as json > /etc/puppetlabs/facter/facts.d/package_updates.json',
      minute   => $minute,
      hour     => $hour,
      month    => $month,
      monthday => $monthday,
      weekday  => $weekday,
    }
  } else {
    notice('The package_updates class only supports non-Windows systems currently')
  }
}