ansible.windows.slurp module – Slurps a file from remote nodes

Note

This module is part of the ansible.windows collection (version 2.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 ansible.windows.

To use it in a playbook, specify: ansible.windows.slurp.

Synopsis

  • This module works like ansible.builtin.fetch. It is used for fetching a base64- encoded blob containing the data in a remote file.

Parameters

Parameter

Comments

src

aliases: path

path / required

The file on the remote system to fetch. This must be a file, not a directory.

Notes

Note

  • This module returns an ‘in memory’ base64 encoded version of the file, take into account that this will require at least twice the RAM as the original file size.

See Also

See also

ansible.builtin.fetch

The official documentation on the ansible.builtin.fetch module.

ansible.builtin.slurp

The official documentation on the ansible.builtin.slurp module.

Examples

- name: Retrieve remote ini file on a Windows host
  ansible.windows.slurp:
    src: C:\Program Files\Program\program.ini
  register: program_conf

- name: Print returned information
  ansible.builtin.debug:
    msg: "{{ program_conf['content'] | b64decode }}"

Return Values

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

Key

Description

content

string

Encoded file content

Returned: success

Sample: "MjE3OQo="

encoding

string

Type of encoding used for file

Returned: success

Sample: "base64"

source

string

Actual path of file slurped

Returned: success

Sample: "C:\\Program Files\\Program\\program.ini"

Authors

  • Ansible Core Team