apt module manages packages and repositories on Debian-based systems using the apt package manager.
Functions
packages
Install, remove, or update apt packages.str | list[str]
List of packages to ensure. Can be a single package name or a list of package names.
bool
default:true
Whether the packages should be installed.
bool
default:false
Whether to upgrade packages without a specified version.
bool
default:false
Run
apt update before installing packages.int
When used with
update, cache package index for this many seconds.bool
default:false
Run
apt upgrade before installing packages.bool
default:false
Force package installs by passing
--force-yes to apt.bool
default:false
Don’t install recommended packages.
bool
default:false
Allow downgrading packages with version (—allow-downgrades).
str
Additional arguments to the apt install command.
str
Additional arguments to the apt uninstall command.
Package versions can be pinned like apt:
<pkg>=<version>Examples
update
Update apt package indexes.int
Cache updates for this many seconds. When set, the
/var/lib/apt/periodic/update-success-stamp file is touched upon successful update.upgrade
Upgrade all apt packages.bool
default:false
Remove transitive dependencies that are no longer needed.
dist_upgrade
Upgrade all apt packages using dist-upgrade.bool
default:false
Remove transitive dependencies that are no longer needed.
repo
Add or remove apt repositories.str
required
Apt source string, e.g.,
deb http://example.com hardy mainbool
default:true
Whether the repo should exist on the system.
str
Optional filename to use
/etc/apt/sources.list.d/<filename>.list. By default uses /etc/apt/sources.list.ppa
Add or remove Ubuntu PPA repositories.str
required
The PPA name in full
ppa:user/repo format.bool
default:true
Whether it should exist.
Requires
apt-add-repository (from software-properties-common) on the remote host.deb
Install or remove .deb package files.str
required
Filename or URL of the
.deb file.bool
default:true
Whether the package should exist on the system.
bool
default:false
Force package install by passing
--force-yes to apt.When installing,
apt-get install -f will be run to install any unmet dependencies.key
Add apt GPG keys.str
Filename or URL of the key file.
str
URL of keyserver to fetch key from.
str | list[str]
Key ID or list of key IDs when using keyserver.
keyserver and keyid must be provided together.