Puppet Class: psick::update

Defined in:
manifests/update.pp

Overview

This class managed system’s packages updates via cron

Parameters:

  • cron_schedule (String) (defaults to: '')

    The cron schedule to use for System Updates. If not set no automatic update is done (unless use_yum_cron is true)

  • update_template (String) (defaults to: 'psick/update/update.sh.erb')

    The erb template to use for the update_script_path

  • update_script_path (String) (defaults to: '/usr/local/sbin/update.sh')

    The path of the script used for system updates

  • use_yum_cron (Boolean) (defaults to: false)

    If to install (only on RedHat derivatives) the yum_cron package (via the ::psick::yum_cron class). If true, the other options are ignored.

  • reboot_after_update (Boolean) (defaults to: false)


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

class psick::update (
  String $cron_schedule        = '',
  Boolean $reboot_after_update = false,
  String $update_template      = 'psick/update/update.sh.erb',
  String $update_script_path   = '/usr/local/sbin/update.sh',
  Boolean $use_yum_cron        = false,
) {

  if $::osfamily == 'RedHat' and $use_yum_cron {
    contain ::psick::yum_cron
    file { '/etc/cron.d/system_update':
      ensure  => absent,
    }
  } else {
    # Custom update script
    if $cron_schedule != '' {
      file { '/etc/cron.d/system_update':
        ensure  => file,
        content => "# File managed by Puppet\n${cron_schedule} root ${update_script_path}\n",
      }
    } else {
      file { '/etc/cron.d/system_update':
        ensure  => absent,
      }
    }

    file { $update_script_path:
      ensure  => file,
      mode    => '0750',
      content => template($update_template),
      before  => File['/etc/cron.d/system_update'],
    }
  }
}