Skip to main content
The zypper module manages packages and repositories on openSUSE and SUSE Linux Enterprise systems.

Functions

packages

Install, remove, or update zypper packages.
str | list[str]
List of packages to ensure.
bool
default:true
Whether the packages should be installed.
bool
default:false
Whether to upgrade packages without a specified version.
bool
default:false
Run zypper update before installing packages.
bool
default:false
Run zypper clean --all before installing packages.
str
Additional global arguments to the zypper install command.
str
Additional arguments to the zypper install command.
str
Additional global arguments to the zypper uninstall command.
str
Additional arguments to the zypper uninstall command.
Package versions can be pinned like zypper: <pkg>=<version>

Examples


update

Update all zypper packages.
This operation is not idempotent - it will always execute.

repo

Add, remove, or update zypper repositories.
str
required
URL or name for the .repo file.
str
The baseurl of the repo (if src is not a URL).
bool
default:true
Whether the .repo file should be present.
str
Optional verbose description.
bool
default:true
Whether this repo is enabled.
bool
default:true
Whether to set gpgcheck=1.
str
The URL to the GPG key for this repo.
str
default:"rpm-md"
The type field for this repo.
baseurl, description, gpgcheck, and gpgkey are only valid when src is a filename (not a URL). Use a URL to download and install remote repository files.

Examples


rpm

Install or remove .rpm package files.
str
required
Filename or URL of the .rpm package.
bool
default:true
Whether the package should exist on the system.
URL sources with present=False: If the .rpm file isn’t downloaded, pyinfra can’t remove any existing package as the file won’t exist until mid-deploy.

key

Add zypper GPG keys with rpm.
str
required
Filename or URL of the GPG key.
This operation is not idempotent - it always returns one command without state checking.
The key operation is inherited from the yum module.

Common Use Cases

Install Docker on openSUSE

Development Environment

Web Server Setup

System Update

Install from Custom Repository

openSUSE-Specific Tips

openSUSE uses patterns for installing groups of related packages:
List and manage repositories:
Lock packages to prevent updates:
Upgrade to a new openSUSE version:

Important Notes

Zypper automatically uses the --non-interactive flag for all operations in pyinfra.
When using custom repositories, always verify the repository’s authenticity and import the GPG key before installing packages.