Ansible vault key stored in another server

Hi Team,

My requirement is to store the vault key in another server, and as part of playbook execution, the ansible reads key value from remote server and decrypts the file on control server. I tried getting the key using modules like slurp and stored as a variable using set_fact. But how do I use it to decrypt the content? I tried something like this but didn’t help,

  • copy:
    src=“{{vaultfile}}”
    dest=“{{local_home}}/decrypted_vault.txt”
    environment:
    ANSIBLE_VAULT_PASSWORD_FILE:{{key}}

Please advise.