community.openwrt.setup module – Gather facts about OpenWrt systems

Note

This module is part of the community.openwrt collection (version 1.1.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.setup.

Synopsis

  • The community.openwrt.setup module gathers facts about OpenWrt systems.

  • It collects system information including distribution details, hostname, network interfaces, services, and device information through ubus.

  • This module is automatically called by playbooks to gather useful variables about remote hosts.

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

  • This module gathers OpenWrt-specific facts including ubus data for network interfaces, devices, services, and system information.

  • Facts are returned in the ansible_facts namespace.

Examples

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

- name: Show distribution version
  ansible.builtin.debug:
    msg: "{{ ansible_distribution_version }}"

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

ansible_distribution

string

The distribution name.

Returned: success

Sample: "OpenWrt"

ansible_distribution_major_version

string

The major version of the distribution.

Returned: success

Sample: "22"

ansible_distribution_release

string

The distribution release codename.

Returned: success

Sample: ""

ansible_distribution_version

string

The distribution version.

Returned: success

Sample: "22.03.5"

ansible_hostname

string

The hostname of the system.

Returned: success

Sample: "router"

ansible_is_chroot

boolean

Whether the system is running in a chroot.

Returned: success

Sample: false

ansible_os_family

string

The OS family.

Returned: success

Sample: "OpenWrt"

openwrt_board

dictionary

Board information from ubus.

Returned: when available

openwrt_devices

dictionary

Network device status from ubus.

Returned: when available

openwrt_info

dictionary

System information from ubus.

Returned: when available

openwrt_interfaces

dictionary

Network interface status from ubus.

Returned: when available

openwrt_services

dictionary

Service list from ubus.

Returned: when available

openwrt_wireless

dictionary

Wireless status from ubus.

Returned: when available

Authors

  • Markus Weippert (@gekmihesg)