community.general.zypper_updates_info module – List available Zypper updates

Note

This module is part of the community.general collection (version 14.0.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.general. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: community.general.zypper_updates_info.

New in community.general 14.0.0

Synopsis

  • List the updates that zypper list-updates reports on SUSE and openSUSE.

Requirements

The below requirements are needed on the host that executes this module.

  • zypper >= 1.0 (included in openSUSE >= 11.1 or SUSE Linux Enterprise Server/Desktop >= 11.0)

  • python-xml

Parameters

Parameter

Comments

all

boolean

Also list updates that cannot be installed because of dependency problems or locks.

Choices:

  • false ← (default)

  • true

type

string

The kind of updates to list.

Choices:

  • "package" (default): Package updates.

  • "patch": Needed patches.

    Patches affecting the package manager itself are returned with updates[].pkgmanager=true. Zypper installs those before any other patch.

  • "pattern": Pattern updates.

  • "product": Product updates.

Attributes

Attribute

Support

Description

check_mode

Support: full

This action does not modify state.

Can run in check_mode and return changed status prediction without modifying target.

diff_mode

Support: N/A

This action does not modify state.

Returns details on what has changed (or possibly needs changing in check_mode), when in diff mode.

Notes

Note

Examples

- name: List package updates
  community.general.zypper_updates_info:
  register: result

- name: List needed patches
  community.general.zypper_updates_info:
    type: patch
  register: patches

- name: Fail when a security patch is needed
  ansible.builtin.assert:
    that: patches.updates | selectattr('category', 'equalto', 'security') | list | length == 0

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

updates

list / elements=dictionary

The available updates, as reported by zypper list-updates.

Returned: always

arch

string

The architecture of the update.

Returned: always

Sample: "x86_64"

arch_old

string

The installed architecture.

Returned: when it differs from updates[].arch

Sample: "i586"

category

string

The category of the patch, as set by the repository. Commonly used values are security, recommended, optional, feature, document and yast.

Returned: when type=patch

Sample: "security"

edition

string

The version of the update.

Returned: always

Sample: "3.2.4-150700.3.6.1"

edition_old

string

The installed version.

Returned: when it differs from updates[].edition

Sample: "3.2.4-150700.3.3.1"

interactive

boolean

Whether the patch needs user interaction.

Returned: when type=patch

Sample: false

issues

list / elements=dictionary

The issues the patch fixes.

Returned: when type=patch

Sample: [{"id": "CVE-2026-1234", "type": "cve"}, {"id": "1234567", "type": "bugzilla"}]

id

string

The identifier of the issue.

Returned: always

Sample: "CVE-2026-1234"

type

string

The kind of the issue, as set by the repository, for example cve or bugzilla.

Returned: always

Sample: "cve"

name

string

The name of the package or patch.

Returned: always

Sample: "openssl-3"

pkgmanager

boolean

Whether the patch affects the package manager itself.

Returned: when type=patch

Sample: false

repository

string

The alias of the repository providing the update.

Returned: when zypper reports it

Sample: "SLE-Module-Basesystem15-SP7-Updates"

restart

boolean

Whether the patch suggests a reboot.

Returned: when type=patch

Sample: false

severity

string

The severity of the patch, as set by the repository. Commonly used values are critical, important, moderate, low and unspecified.

Returned: when type=patch

Sample: "important"

status

string

The status of the patch. Without all=true, zypper lists only patches with status needed, optional or unwanted.

Returned: when type=patch

Can only return:

  • "needed"

  • "optional"

  • "unwanted"

  • "applied"

  • "not-needed"

  • "undetermined"

  • "retracted"

Sample: "needed"

summary

string

The summary of the package or patch.

Returned: always

Sample: "Secure Sockets and Transport Layer Security"

type

string

The kind of the update, as selected with type.

Returned: always

Can only return:

  • "package"

  • "patch"

  • "pattern"

  • "product"

Sample: "package"

Authors

  • Harshvardhan Sharma (@HVSharma12)