community.general.apk module – Manages apk packages
Note
This module is part of the community.general collection (version 9.5.0).
You might already have this collection installed if you are using the ansible
package. It is not included in ansible-core
. To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.general
.
To use it in a playbook, specify: community.general.apk
.
Synopsis
- Manages
apk
packages for Alpine Linux.
Parameters
Parameter | Comments |
---|---|
available boolean | During upgrade, reset versioned world dependencies and change logic to prefer replacing or downgrading packages (instead of holding them) if the currently installed package is no longer available from any repository. Choices:
|
name list / elements=string | A package name, like Do not include additional whitespace when specifying multiple packages as a string. Prefer YAML lists over comma-separating multiple package names. |
no_cache boolean added in community.general 1.0.0 | Do not use any local cache path. Choices:
|
repository list / elements=string | A package repository or multiple repositories. Unlike with the underlying apk command, this list will override the system repositories rather than supplement them. |
state string | Indicates the desired package(s) state.
Choices:
|
update_cache boolean | Update repository indexes. Can be run with other steps or on its own. Choices:
|
upgrade boolean | Upgrade all installed packages to their latest version. Choices:
|
world string added in community.general 5.4.0 | Use a custom world file when checking for explicitly installed packages. Default: |
Attributes
Attribute | Support | Description |
---|---|---|
check_mode | Support: full | Can run in |
diff_mode | Support: none | Will return details on what has changed (or possibly needs changing in |
Notes
Examples
- name: Update repositories and install foo package community.general.apk: name: foo update_cache: true - name: Update repositories and install foo and bar packages community.general.apk: name: foo,bar update_cache: true - name: Remove foo package community.general.apk: name: foo state: absent - name: Remove foo and bar packages community.general.apk: name: foo,bar state: absent - name: Install the package foo community.general.apk: name: foo state: present - name: Install the packages foo and bar community.general.apk: name: foo,bar state: present - name: Update repositories and update package foo to latest version community.general.apk: name: foo state: latest update_cache: true - name: Update repositories and update packages foo and bar to latest versions community.general.apk: name: foo,bar state: latest update_cache: true - name: Update all installed packages to the latest versions community.general.apk: upgrade: true - name: Upgrade / replace / downgrade / uninstall all installed packages to the latest versions available community.general.apk: available: true upgrade: true - name: Update repositories as a separate step community.general.apk: update_cache: true - name: Install package from a specific repository community.general.apk: name: foo state: latest update_cache: true repository: http://dl-3.alpinelinux.org/alpine/edge/main - name: Install package without using cache community.general.apk: name: foo state: latest no_cache: true - name: Install package checking a custom world community.general.apk: name: foo state: latest world: /etc/apk/world.custom
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key | Description |
---|---|
packages list / elements=string | a list of packages that have been changed Returned: when packages have changed Sample: |
Collection links
© 2012–2018 Michael DeHaan
© 2018–2024 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/general/apk_module.html