1

Is there a way to use the password given in ask-vault-pass inside a playbook. example, assuming I give test123 as vault password and the ask-vault-pass is saved in a fact called "ANSIBLE_VAULT_PASSWORD":

ex:

$: ansible-playbook -l myhost myplaybook.yml -i myinventory --ask-vault-pass
Vault password: test123

myplaybook.yml:

- host: all
  pre_tasks:
    - name: "print the vault password"
      debug:
        - msg: "{{ ANSIBLE_VAULT_PASSWORD }}" 

output should be something like:

TASK [DEBUG] ***************************************
ok: [myhost] => {
     "msg": "test123"
} 

the question is: is there a fact like ANSIBLE_VAULT_PASSWORD that store the password given with ask-vault-pass or any other way to retrieve it?

Laurel
  • 5,965
  • 14
  • 31
  • 57

0 Answers0