community.general.xbps module – Manage packages with XBPS

Note

This module is part of the community.general collection (version 4.8.3).

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.xbps.

Synopsis

  • Manage packages with the XBPS package manager.

Parameters

Parameter

Comments

name

aliases: pkg, package

list / elements=string

Name of the package to install, upgrade, or remove.

recurse

boolean

When removing a package, also remove its dependencies, provided that they are not required by other packages and were not explicitly installed by a user.

Choices:

  • no ← (default)

  • yes

state

string

Desired state of the package.

Choices:

  • present ← (default)

  • absent

  • latest

  • installed

  • removed

update_cache

aliases: update-cache

boolean

Whether or not to refresh the master package lists. This can be run as part of a package installation or as a separate step.

Alias update-cache has been deprecated and will be removed in community.general 5.0.0.

Choices:

  • no

  • yes ← (default)

upgrade

boolean

Whether or not to upgrade whole system

Choices:

  • no ← (default)

  • yes

upgrade_xbps

boolean

added in 0.2.0 of community.general

Whether or not to upgrade the xbps package when necessary. Before installing new packages, xbps requires the user to update the xbps package itself. Thus when this option is set to no, upgrades and installations will fail when xbps is not up to date.

Choices:

  • no

  • yes ← (default)

Examples

- name: Install package foo (automatically updating the xbps package if needed)
  community.general.xbps: name=foo state=present

- name: Upgrade package foo
  community.general.xbps: name=foo state=latest update_cache=yes

- name: Remove packages foo and bar
  community.general.xbps: name=foo,bar state=absent

- name: Recursively remove package foo
  community.general.xbps: name=foo state=absent recurse=yes

- name: Update package cache
  community.general.xbps: update_cache=yes

- name: Upgrade packages
  community.general.xbps: upgrade=yes

- name: Install a package, failing if the xbps package is out of date
  community.general.xbps:
    name: foo
    state: present
    upgrade_xbps: no

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

msg

string

Message about results

Returned: success

Sample: “System Upgraded”

packages

list / elements=string

Packages that are affected/would be affected

Returned: success

Sample: [“ansible”]

Authors

  • Dino Occhialini (@dinoocch)

  • Michael Aldridge (@the-maldridge)