ansible.builtin.win_updates (v2.4.2.0-1) — module

Download and install Windows updates

| "added in version" 2.0 of ansible.builtin"

Authors: Matt Davis (@mattdavispdx)

preview | supported by core

Install Ansible via pip

Install with pip install ansible==2.4.2.0.post1

Description

Searches, downloads, and installs Windows updates synchronously by automating the Windows Update client

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Install all security, critical, and rollup updates
- win_updates:
    category_names:
      - SecurityUpdates
      - CriticalUpdates
      - UpdateRollups
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Install only security updates
- win_updates:
    category_names: SecurityUpdates
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Search-only, return list of found updates (if any), log to c:\ansible_wu.txt
- win_updates:
    category_names: SecurityUpdates
    state: searched
    log_path: c:\ansible_wu.txt

Inputs

    
state:
    choices:
    - installed
    - searched
    default: installed
    description:
    - Controls whether found updates are returned as a list or actually installed.
    - This module also supports Ansible check mode, which has the same effect as setting
      state=searched
    required: false

log_path:
    description:
    - If set, C(win_updates) will append update progress to the specified file. The directory
      must already exist.
    required: false

category_names:
    choices:
    - Application
    - Connectors
    - CriticalUpdates
    - DefinitionUpdates
    - DeveloperKits
    - FeaturePacks
    - Guidance
    - SecurityUpdates
    - ServicePacks
    - Tools
    - UpdateRollups
    - Updates
    default:
    - CriticalUpdates
    - SecurityUpdates
    - UpdateRollups
    description:
    - A scalar or list of categories to install updates from
    required: false

Outputs

failed_update_count:
  description: The number of updates that failed to install
  returned: always
  sample: 0
  type: int
found_update_count:
  description: The number of updates found needing to be applied
  returned: success
  sample: 3
  type: int
installed_update_count:
  description: The number of updates successfully installed
  returned: success
  sample: 2
  type: int
reboot_required:
  description: True when the target server requires a reboot to complete updates (no
    further updates can be installed until after a reboot)
  returned: success
  sample: true
  type: boolean
updates:
  contains:
    failure_hresult_code:
      description: The HRESULT code from a failed update
      returned: on install failure
      sample: 2147942402
      type: boolean
    id:
      description: Internal Windows Update GUID
      returned: always
      sample: fb95c1c8-de23-4089-ae29-fd3351d55421
      type: string (guid)
    installed:
      description: Was the update successfully installed
      returned: always
      sample: true
      type: boolean
    kb:
      description: A list of KB article IDs that apply to the update
      returned: always
      sample:
      - '3004365'
      type: list of strings
    title:
      description: Display name
      returned: always
      sample: Security Update for Windows Server 2012 R2 (KB3004365)
      type: string
  description: List of updates that were found/installed
  returned: success
  sample: null
  type: complex