W3cubDocs

/Ansible

apk - Manages apk packages

New in version 2.0.

Synopsis

Manages apk packages for Alpine Linux.

Options

parameter required default choices comments
name
no
A package name, like foo, or mutliple packages, like foo, bar.
state
no present
  • present
  • absent
  • latest
Indicates the desired package(s) state.
present ensures the package(s) is/are present.
absent ensures the package(s) is/are absent.
latest ensures the package(s) is/are present and the latest version(s).
update_cache
no
  • yes
  • no
Update repository indexes. Can be run with other steps or on it's own.
upgrade
no
  • yes
  • no
Upgrade all installed packages to their latest version.

Examples

# Update repositories and install "foo" package
- apk: name=foo update_cache=yes

# Update repositories and install "foo" and "bar" packages
- apk: name=foo,bar update_cache=yes

# Remove "foo" package
- apk: name=foo state=absent

# Remove "foo" and "bar" packages
- apk: name=foo,bar state=absent

# Install the package "foo"
- apk: name=foo state=present

# Install the packages "foo" and "bar"
- apk: name=foo,bar state=present

# Update repositories and update package "foo" to latest version
- apk: name=foo state=latest update_cache=yes

# Update repositories and update packages "foo" and "bar" to latest versions
- apk: name=foo,bar state=latest update_cache=yes

# Update all installed packages to the latest versions
- apk: upgrade=yes

# Update repositories as a separate step
- apk: update_cache=yes

Notes

Note

“name” and “upgrade” are mutually exclusive.

This is an Extras Module

For more information on what this means please read Extras Modules

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, developing_test_pr and Developing Modules.

© 2012–2016 Michael DeHaan
© 2016 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/apk_module.html