Puppet Class: patching_as_code::windows::patchday

Defined in:
manifests/windows/patchday.pp

Summary

This class gets called by init.pp to perform the actual patching on Windows.

Overview

Class: patching_as_code::windows::patchday

Parameters:

  • updates (Array)

    List of Windows KB patches to install.

  • choco_updates (Array)

    List of Chocolatey packages to update.

  • high_prio_updates (Array) (defaults to: [])

    List of high-priority Windows KB patches to install.

  • high_prio_choco_updates (Array) (defaults to: [])

    List of high-priority Chocolatey packages to update.



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

class patching_as_code::windows::patchday (
  Array $updates,
  Array $choco_updates,
  Array $high_prio_updates = [],
  Array $high_prio_choco_updates = []
) {
  if $updates.count > 0 {
    $updates.each | $kb | {
      patching_as_code::kb { $kb:
        ensure      => 'present',
        maintwindow => 'Patching as Code - Patch Window',
      }
    }
  }

  if $high_prio_updates.count > 0 {
    $high_prio_updates.each | $kb | {
      patching_as_code::kb { $kb:
        ensure      => 'present',
        maintwindow => 'Patching as Code - High Priority Patch Window',
      }
    }
  }

  if $choco_updates.count > 0 {
    $choco_updates.each | $package | {
      patch_package { $package:
        patch_window => 'Patching as Code - Patch Window',
        chocolatey   => true,
      }
    }
  }

  if $high_prio_choco_updates.count > 0 {
    $high_prio_choco_updates.each | $package | {
      patch_package { $package:
        patch_window => 'Patching as Code - High Priority Patch Window',
        chocolatey   => true,
      }
    }
  }

  anchor { 'patching_as_code::patchday::end': } #lint:ignore:anchor_resource
}