How to set and use sudo password for Ansible Vault

Originally published at:

How can I set a sudo password for Ansible from the Linux or Unix cli? How can I store sudo password in a vault file and use it securely without exposing my details?


What if I had several passwords for different hosts/groups? How could I solve this with ansible-vault?

1 Like

Yes it is possible. See


Thanks for the answer. Actually I was referring to having multiple sudo passwords in the same vault file (not several vault passwords), in case I have a different password for each server and I wanted to deploy the same script on several servers.