Skip to content

Schedule WSUS updates

Go to Automation

View in GitLab

Description

This automation schedules WSUS updates on Windows servers using Ansible Controller. It ensures that all necessary variables are defined, creates required directories and files, and runs a scheduler script to manage the updates. The playbook performs the following tasks: validates that all required variables are defined to avoid runtime errors, creates a log file for tracking the scheduling process of WSUS updates, copies the logrotate configuration to manage the log file rotation, sets up necessary directories for storing scheduler scripts and related files, copies SQL, shell, mail template, and Python scripts to the appropriate directory for execution, executes the scheduler script with the provided variables to schedule the updates, and fails the playbook if the scheduler script encounters any errors and displays the results for troubleshooting.

schedule-wsus-updates.sql This SQL script retrieves server update schedules from the server database.

schedule-wsus-updates.sh This shell script schedules WSUS updates by interacting with the Ansible Tower API and the server database.

schedule-wsus-updates.py This Python script sends email notifications about WSUS update maintenances to specified recipients.

schedule-wsus-updates.mailtemplate This HTML file is the email template used by the Python script to notify recipients about WSUS update maintenances.

schedule-wsus-updates.logrotate This logrotate configuration file manages the rotation of the log file created by the scheduler script.

Credentials

  • sys_ansible_serverupdates (Username for Ansible Tower)
  • Neon API - PR
  • DG_ServersUser1 (SQL user)
  • sys_ansible_smtp (Password for SMTP server)

Input

Variable Description
target Name of the Ansible server to execute the task
daysinadvance Number of days in advance to schedule
debug Boolean to enable debug default: false

Output

None

Dependencies