ansible.windows.slurp (2.3.0) — module

Slurps a file from remote nodes

Authors: Ansible Core Team

Install collection

Install with ansible-galaxy collection install ansible.windows:==2.3.0


Add to requirements.yml

  collections:
    - name: ansible.windows
      version: 2.3.0

Description

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

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Retrieve remote ini file on a Windows host
  ansible.builtin.slurp:
    src: C:\Program Files\Program\program.ini
  register: program_conf
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Print returned information
  ansible.builtin.debug:
    msg: "{{ program_conf['content'] | b64decode }}"

Inputs

    
src:
    aliases:
    - path
    description:
    - The file on the remote system to fetch. This I(must) be a file, not a directory.
    required: true
    type: path

Outputs

content:
  description: Encoded file content
  returned: success
  sample: MjE3OQo=
  type: str
encoding:
  description: Type of encoding used for file
  returned: success
  sample: base64
  type: str
source:
  description: Actual path of file slurped
  returned: success
  sample: C:\Program Files\Program\program.ini
  type: str

See also