Created
September 16, 2021 18:35
-
-
Save JonathonAnderson/59af1753ae7b41f9fc32ce372a2555a0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Check for pending reboots before attempting to update | |
reboot { 'pre_patch_reboot': | |
schedule => 'patch_window', | |
when => 'pending', | |
message => 'Reboot pending. Rebooting before attempting updates...', | |
} | |
Reboot['pre_patch_reboot'] -> Reboot['post_patch_reboot'] | |
# Apply allowed/needed updates | |
$updates.each | $kb | { | |
windows_updates::kb { $kb: | |
ensure => 'present', | |
maintwindow => 'patch_window', | |
} | |
Reboot['pre_patch_reboot'] -> Windows_Updates::Kb[$kb] -> Reboot['post_patch_reboot'] | |
} | |
# Reboot after updates if needed | |
reboot { 'post_patch_reboot': | |
schedule => 'patch_window', | |
when => 'pending', | |
message => 'Updates Installed. Rebooting.', | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment