salt.modules.apt

Support for APT (Advanced Packaging Tool)

Members

available_version

salt.modules.apt.available_version(name)

Return the latest version of the named package available for upgrade or installation via the available apt repository

CLI Example:

salt '*' pkg.available_version <package name>

install

salt.modules.apt.install(pkg, refresh=False, repo='', skip_verify=False, debconf=None, version=None, **kwargs)

Install the passed package

pkg
The name of the package to be installed
refresh : False
Update apt before continuing
repo : (default)
Specify a package repository to install from (e.g., apt-get -t unstable install somepackage)
skip_verify : False
Skip the GPG verification check (e.g., --allow-unauthenticated)
debconf : None
Provide the path to a debconf answers file, processed before installation.
version : None
Install a specific version of the package, e.g. 1.0.9~ubuntu

Return a dict containing the new package names and versions:

{'<package>': {'old': '<old-version>',
        'new': '<new-version>']}

CLI Example:

salt '*' pkg.install <package name>

list_pkgs

salt.modules.apt.list_pkgs(regex_string='')

List the packages currently installed in a dict:

{'<package_name>': '<version>'}

External dependencies:

Virtual package resolution requires aptitude.
Without aptitude virtual packages will be reported as not installed.

CLI Example:

salt '*' pkg.list_pkgs
salt '*' pkg.list_pkgs httpd

list_upgrades

salt.modules.apt.list_upgrades()

List all available package upgrades.

CLI Example:

salt '*' pkg.list_upgrades

purge

salt.modules.apt.purge(pkg)

Remove a package via apt-get purge along with all configuration files and unused dependencies.

Returns a list containing the names of the removed packages

CLI Example:

salt '*' pkg.purge <package name>

refresh_db

salt.modules.apt.refresh_db()

Updates the APT database to latest packages based upon repositories

Returns a dict:

{'<database name>': Bool}

CLI Example:

salt '*' pkg.refresh_db

remove

salt.modules.apt.remove(pkg)

Remove a single package via apt-get remove

Returns a list containing the names of the removed packages.

CLI Example:

salt '*' pkg.remove <package name>

upgrade

salt.modules.apt.upgrade(refresh=True, **kwargs)

Upgrades all packages via apt-get dist-upgrade

Returns a list of dicts containing the package names, and the new and old versions:

[
    {'<package>':  {'old': '<old-version>',
                'new': '<new-version>']
    }',
    ...
]

CLI Example:

salt '*' pkg.upgrade

upgrade_available

salt.modules.apt.upgrade_available(name)

Check whether or not an upgrade is available for a given package

CLI Example:

salt '*' pkg.upgrade_available <package name>

version

salt.modules.apt.version(name)

Returns a string representing the package version or an empty string if not installed

CLI Example:

salt '*' pkg.version <package name>

Parent topic

Table Of Contents

Previous topic

salt.modules.apache

Next topic

salt.modules.archive