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
The community.openwrt.slurp module reads a file from the OpenWrt target and encodes it in base64.
Note
This module has a corresponding action plugin.
Parameters
Parameter |
Comments |
|---|---|
The file on the remote system to fetch. This must be a file, not a directory. |
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 |
|
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 |
|---|---|
Base64 encoded content of the file. Returned: always Sample: |
|
The encoding used for the content. Returned: always Sample: |
|
Path to the file that was read. Returned: always Sample: |