# Yum

Manage yum packages and repositories. Note that yum package names are case-sensitive.

## `yum.key`

Add yum gpg keys with `rpm`.

    yum.key(key)

- key: filename or URL

Note:
  always returns one command, not state checking

## `yum.packages`

Manage yum packages & updates.

    yum.packages(packages=None, present=True, latest=False, update=False, clean=False)

- packages: list of packages to ensure
- present: whether the packages should be installed
- latest: whether to upgrade packages without a specified version
- update: run yum update
- clean: run yum clean

## `yum.repo`

Manage yum repositories.

    yum.repo(name, baseurl, present=True, description=None, gpgcheck=True, enabled=True)

- name: filename for the repo (in `/etc/yum/repos.d/`)
- baseurl: the baseurl of the repo
- present: whether the `.repo` file should be present
- description: optional verbose description
- gpgcheck: whether set `gpgcheck=1`

## `yum.rpm`

Install/manage `.rpm` file packages.

    yum.rpm(source, present=True)

- source: filename or URL of the `.rpm` package
- present: whether ore not 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.

## `yum.update`

Updates all yum packages.

    yum.update()