community.openwrt.package_facts module – Gather package facts in OpenWrt systems

Note

This module is part of the community.openwrt collection (version 1.2.0).

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

To use it in a playbook, specify: community.openwrt.package_facts.

New in community.openwrt 1.1.0

Synopsis

  • The community.openwrt.package_facts module gathers facts about installed packages in OpenWrt systems.

  • It collects package name, version and package version of every installed package.

  • This module should be called manually by playbooks when needed. It’s not part of the setup task.

Note

This module has a corresponding action plugin.

Attributes

Attribute

Support

Description

check_mode

Support: full

This action does not modify state.

Can run in check_mode and return changed status prediction without modifying target.

diff_mode

Support: N/A

This action does not modify state.

Returns details on what has changed (or possibly needs changing in check_mode), when in diff mode.

facts

Support: full

Action returns an ansible_facts dictionary that updates existing host facts.

platform

Platform: OpenWrt

Target platform for this module.

Notes

Note

  • Facts are returned in the ansible_facts namespace (packages key).

Examples

- name: Gather facts from OpenWrt device
  community.openwrt.package_facts:

- name: Show installed packages
  ansible.builtin.debug:
    msg: "{{ ansible_facts['packages'] }}"

Returned Facts

Facts returned by this module are added/updated in the hostvars host facts and can be referenced by name just like any other host fact. They do not need to be registered in order to use them.

Key

Description

packages

dictionary

Maps the package name to a non-empty list of dicts with package information.

Every dict in the list corresponds to one installed version of the package.

The fields described below are present for the package manager detected (apk or opkg).

Returned: when operating system level package manager is auto detected succesfully.

Sample: {"packages": {"apk-mbedtls": [{"name": "apk-mbedtls", "release": "r2", "source": "apk", "version": "3.0.2"}], "zlib": [{"name": "zlib", "release": "r1", "source": "apk", "version": "1.3.1"}]}}

name

string

The package name.

Returned: success

Sample: "zlib"

release

string

The release version of the package.

Returned: success

Sample: "r1"

source

string

The package management detected.

Returned: success

Sample: "apk"

version

string

The version of the software.

Returned: success

Sample: "1.3.1"

Authors

  • Sebastián Guarino (@sguarin)