How to set and use sudo password for Ansible Vault

Originally published at: https://www.cyberciti.biz/faq/how-to-set-and-use-sudo-password-for-ansible-vault/

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?

Hi,

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 https://docs.ansible.com/ansible/2.4/vault#multiple-vault-passwords

Hi,

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.