Skip to content

apk

Apk package tasks

This module provides tasks for interacting with the apk package manager.

packages(packages=None, present=True, latest=False, update=False, upgrade=False)

Add/remove/update apk packages.

  • packages: list of packages to ensure
  • present: whether the packages should be installed
  • latest: whether to upgrade packages without a specified version
  • update: run apk update before installing packages
  • upgrade: run apk upgrade before installing packages
Versions

Package versions can be pinned like apk: <pkg>=<version>.

Examples:

.. code:: python

# Update package list and install packages
apk.packages(
    name="Install Asterisk and Vim",
    packages=["asterisk", "vim"],
    update=True,
)

# Install the latest versions of packages (always check)
apk.packages(
    name="Install latest Vim",
    packages=["vim"],
    latest=True,
)

update()

Updates apk repositories.

upgrade(available=False)

Upgrades all apk packages.

  • available: force all packages to be upgraded (recommended on whole Alpine version upgrades)