Howto read variables from an vaut encrypted file

Hi all,

the following task may sound easy but actually it fails all the time …

I want to store my password in a variable and put it into an ansible-vault encrypted file.
The content of this file will look like this:

`

Ansilbe reads the 'root_pass_sirus' variable fine, the problem is that
'TesT1234' variable isn't defined anywhere.

Hi Brian,

of course not. it’s supposed to be the value of ‘root_pass_sirus’ …

Brian provided a clue in his answer, but to make it more explicit: root_pass_sirius is not correctly declared.

Instead of:
root_pass_sirius: "{{ TesT1234 }}"
it should be:
root_pass_sirius: "TesT1234"

You want the password to have the value "TesT1234" - in the incorrect declaration, it's being set to the value of a variable called TesT1234, which doesn't exist. Remove the {{ }} and it'll work.

Cheers, MJ

My limited understanding is that this:

root_pass_sirius: “{{ TesT1234 }}”

…is definting another variable called “TesT1234” rather than assigning the literal “TesT1234” to the variable “root_pass_sirius” like:

root_pass_sirius: “TesT1234”

unbeliveable … but that was it !!
Thanks a lot :slight_smile: