Skip to main content
The yum module manages packages and repositories on RHEL/CentOS systems using the yum package manager.
Yum package names are case-sensitive.

Functions

packages

Install, remove, or update yum 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 yum update before installing packages.
bool
default:false
Run yum clean all before installing packages.
bool
default:false
Add the —nobest option to install.
str
Additional arguments to the yum install command.
str
Additional arguments to the yum uninstall command.
Package versions can be pinned as: <pkg>=<version>

Examples


update

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

repo

Add, remove, or update yum repositories.
str
required
URL or name for the .repo file.
bool
default:true
Whether the .repo file should be present.
str
The baseurl of the repo (if src is not a URL).
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.
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 yum 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.

Common Use Cases

Install EPEL Repository

Install Docker on CentOS

Development Environment