community.general.apk (0.1.4) — module

Manages apk packages

Authors: Kevin Brebanov (@kbrebanov)

Install collection

Install with ansible-galaxy collection install community.general:==0.1.4


Add to requirements.yml

  collections:
    - name: community.general
      version: 0.1.4

Description

Manages I(apk) packages for Alpine Linux.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Update repositories and install foo package
  apk:
    name: foo
    update_cache: yes
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Update repositories and install foo and bar packages
  apk:
    name: foo,bar
    update_cache: yes
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove foo package
  apk:
    name: foo
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove foo and bar packages
  apk:
    name: foo,bar
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Install the package foo
  apk:
    name: foo
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Install the packages foo and bar
  apk:
    name: foo,bar
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Update repositories and update package foo to latest version
  apk:
    name: foo
    state: latest
    update_cache: yes
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Update repositories and update packages foo and bar to latest versions
  apk:
    name: foo,bar
    state: latest
    update_cache: yes
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Update all installed packages to the latest versions
  apk:
    upgrade: yes
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Upgrade / replace / downgrade / uninstall all installed packages to the latest versions available
  apk:
    available: yes
    upgrade: yes
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Update repositories as a separate step
  apk:
    update_cache: yes
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Install package from a specific repository
  apk:
    name: foo
    state: latest
    update_cache: yes
    repository: http://dl-3.alpinelinux.org/alpine/edge/main

Inputs

    
name:
    description:
    - A package name, like C(foo), or multiple packages, like C(foo, bar).
    elements: str
    type: list

state:
    choices:
    - present
    - absent
    - latest
    default: present
    description:
    - Indicates the desired package(s) state.
    - C(present) ensures the package(s) is/are present.
    - C(absent) ensures the package(s) is/are absent.
    - C(latest) ensures the package(s) is/are present and the latest version(s).

upgrade:
    default: 'no'
    description:
    - Upgrade all installed packages to their latest version.
    type: bool

available:
    default: 'no'
    description:
    - 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.
    type: bool

repository:
    description:
    - A package repository or multiple repositories. Unlike with the underlying apk command,
      this list will override the system repositories rather than supplement them.

update_cache:
    default: 'no'
    description:
    - Update repository indexes. Can be run with other steps or on it's own.
    type: bool

Outputs

packages:
  description: a list of packages that have been changed
  returned: when packages have changed
  sample:
  - package
  - other-package
  type: list