Skip to main content

slurp

slurp module

Fetch a file from the remote host and encode its content as base64. This module is useful for reading configuration files or other data from remote systems.

Examples

- name: Read remote file
slurp:
src: /etc/hostname
register: hostname_content

- name: Display file content
debug:
msg: "{{ hostname_content.content | b64decode }}"

- name: Read configuration file
slurp:
src: /etc/nginx/nginx.conf
register: nginx_config

- name: Save remote file locally
copy:
content: "{{ remote_file.content | b64decode }}"
dest: /tmp/local_copy.txt
vars:
remote_file: "{{ slurp_result }}"

Note: The file content is automatically base64 encoded. Use the 'b64decode' filter to get the original content.

Module Capabilities

  • Has Revert: false
  • Provides Variables: None

Inputs

ParameterTypeDescriptionRequiredDefaultChoices
srcstringPath to the file to fetch from the remote node. The file content will be base64 encoded.false

Outputs

No outputs.