community.openwrt.setup module – Gather facts about 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.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 |
|---|---|---|
Support: full This action does not modify state. |
Can run in |
|
Support: N/A This action does not modify state. |
Returns details on what has changed (or possibly needs changing in |
|
Support: full |
Action returns an |
|
Platform: OpenWrt |
Target platform for this module. |
Notes
Note
This module gathers OpenWrt-specific facts including
ubusdata for network interfaces, devices, services, and system information.Facts are returned in the
ansible_factsnamespace.The fact
ansible_date_timewas added in community.openwrt 1.1.0.The facts
ansible_date_time.iso8601_microandansible_date_time.iso8601_basicare meant to include microseconds, but the busybox implementation ofdatedoes not provide time with that precision, so those facts are reported with000000as the value for the microseconds fraction.Note: If you install the package
coreutils-date, community.openwrt.setup generates the actual microseconds foransible_date_timefactoids.In ansible.builtin.setup, the fact
ansible_date_time.epoch_intis the epoch number, transformed toint, and then back tostr, which is ineffective in a shell script. The fact is provided to ensure compatibility with the standard module, but its value is always the same as ofansible_date_time.epoch.Conversely,
ansible_date_time.tz_dstis obtained in the standard module through an internal Python function, so in order to provide compatibility, that fact is returned by community.openwrt.setup with the exact same value asansible_date_time.tz.
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 |
|---|---|
System date and time. Returned: always |
|
The distribution name. Returned: always Sample: |
|
The major version of the distribution. Returned: always Sample: |
|
The distribution release codename. Returned: always Sample: |
|
The distribution version. Returned: always Sample: |
|
The hostname of the system. Returned: always Sample: |
|
Whether the system is running in a chroot. Returned: always Sample: |
|
The OS family. Returned: always Sample: |
|
Board information from Returned: when available |
|
Network device status from Returned: when available |
|
System information from Returned: when available |
|
Network interface status from Returned: when available |
|
Service list from Returned: when available |
|
Wireless status from Returned: when available |