ansible.builtin.b64encode filter – Encode a string as base64

Note

This filter plugin is part of ansible-core and included in all Ansible installations. In most cases, you can use the short plugin name b64encode even without specifying the collections: keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same filter plugin name.

Synopsis

  • Base64 encoding function.

Input

This describes the input of the filter, the value before | ansible.builtin.b64encode.

Parameter

Comments

Input

string / required

A string to encode.

Examples

# b64 encode a string
b64lola: "{{ 'lola'|b64encode }}"

# b64 encode the content of 'stuff' variable
b64stuff: "{{ stuff|b64encode }}"

Return Value

Key

Description

Return value

string

A base64 encoded string.

Returned: success

Authors

  • ansible core team

Hint

Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.