Skip to content

b64decode

Collection Note

This module is part of the ansible.builtin collection. To install the collection, use:

ansible-galaxy collection install ansible.builtin
Added in version historical.

Synopsis

  • Base64 decoding function.
  • The return value is a string.
  • Trying to store a binary blob in a string most likely corrupts the binary. To Base64 decode a binary blob, use the I(base64) command and pipe the encoded data through standard input. For example, in the M(ansible.builtin.shell) module, cmd="base64 --decode > myfile.bin" stdin="{{ encoded }}".

Parameters

Parameter Defaults / Choices Comments
_input
string
required
A Base64 string to decode.

Examples

# Base64 decode a string
lola: "{{ 'bG9sYQ==' | b64decode }}"

# Base64 decode the content of 'b64stuff' variable
stuff: "{{ b64stuff | b64decode }}"

Return Values

Key Data Type Description Returned
_value string The contents of the Base64 encoded string.

Authors

  • Ansible Core Team