Apt¶
Manage apt packages and repositories.
apt.deb
¶
Install/manage .deb
file packages.
apt.deb(source, present=True)
- source: filename or URL of the
.deb
file - present: whether or not the package should exist on the system
- Note:
- when installing,
apt-get install -f
will be run to install any unmet dependencies - URL sources with
present=False
: - if the
.deb
file isn’t downloaded, pyinfra can’t remove any existing package as the file won’t exist until mid-deploy
apt.key
¶
Add apt gpg keys with apt-key
.
apt.key(key=None, keyserver=None, keyid=None)
- key: filename or URL
- keyserver: URL of keyserver to fetch key from
- keyid: key identifier when using keyserver
- Note:
- Always returns an add command, not state checking.
- keyserver/id:
- These must be provided together.
apt.packages
¶
Install/remove/upgrade packages & update apt.
apt.packages(packages=None, present=True, latest=False, update=False, cache_time=None, upgrade=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 apt update
- cache_time: when used with update, cache for this many seconds
- upgrade: run apt upgrade
- Versions:
- Package versions can be pinned like apt:
<pkg>=<version>
- Note:
cache_time
only works on systems that provide the/var/lib/apt/periodic/update-success-stamp
file (ie Ubuntu).
apt.ppa
¶
Manage Ubuntu ppa repositories.
apt.ppa(name, present=True)
- name: the PPA name
- present: whether it should exist
- Note:
- requires
apt-add-repository
on the remote host
apt.repo
¶
Manage apt repositories.
apt.repo(name, present=True, filename=None)
- name: apt source string eg
deb http://X hardy main
- present: whether the repo should exist on the system
- filename: optional filename to use
/etc/apt/sources.list.d/<filename>.list
. By default uses/etc/apt/sources.list
.