community.openwrt.slurp module – Slurps a file from remote OpenWrt nodes

Note

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

Synopsis

Note

This module has a corresponding action plugin.

Parameters

Parameter

Comments

src

aliases: path

string / required

The file on the remote system to fetch.

This must be a file, not a directory.

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.

platform

Platform: OpenWrt

Target platform for this module.

Examples

- name: Read a configuration file
  community.openwrt.slurp:
    src: /etc/config/network
  register: network_config

- name: Decode the file content
  ansible.builtin.debug:
    msg: "{{ network_config.content | b64decode }}"

- name: Fetch a file for later use
  community.openwrt.slurp:
    src: /etc/dropbear/dropbear_rsa_host_key
  register: ssh_key

Return Values

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

Key

Description

content

string

Base64 encoded content of the file.

Returned: always

Sample: "IyBUaGlzIGlzIGEgdGVzdAo="

encoding

string

The encoding used for the content.

Returned: always

Sample: "base64"

source

string

Path to the file that was read.

Returned: always

Sample: "/etc/config/network"

Authors

  • Markus Weippert (@gekmihesg)