Ansible - Decode a string using the b64decode filter

The b64decode filter is used to decode a string. The b64encode filter is used to encode a string. In this example, base 64 string Zm9v is decoded.

Notice in this example that Zm9v is wrapped in quotes. When wrapped in quotes, Zm9v is interpreted as a string. If Zm9v were not wrapped in quotes, Zm9v would be interpreted as a variable.

- name: "decoded the 'Zm9v' string"
    msg: "{{ 'Zm9v' | b64decode }}"


The following should be returned.

TASK [decode the 'Zm9v' string]
ok: [] => {
    "msg": [


Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter ee35c in the box below so that we can be sure you are a human.


Web design by yours truely - me, myself, and I   |   |