# connection to multiple hosts with all different passwords

**URL:** <https://forum.ansible.com/t/connection-to-multiple-hosts-with-all-different-passwords/26920>\
**Category:** Ansible Project\
**Created:** [March 7, 2018, 12:48pm UTC](https://forum.ansible.com/t/connection-to-multiple-hosts-with-all-different-passwords/26920 "2018-03-07T12:48:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![neccross9](https://avatars.discourse-cdn.com/v4/letter/n/f0a364/32.png) [@neccross9](https://forum.ansible.com/u/neccross9)\
**Post date:** [March 7, 2018, 12:48pm UTC](https://forum.ansible.com/t/connection-to-multiple-hosts-with-all-different-passwords/26920/1 "2018-03-07T12:48:45Z")

</div>

Hi all,

I’m new to Ansible, so please excuse myl lack of knowledge

I’m tryting to handle multiple hosts that need to execute some tasks being root.  
While it’s not a good idea to have all root-ssh-keys stored on one machine (the Ansible host), I want to connect to a box using a generic “ansible” user and then do a sudo (or su) to root  
All hosts have different root-passwords. So I put some in an ansible-vault file and encrypted it.

Now I trie to build a playbook, that connects to a group of hosts - using the “ansible” user - sudo to root and e.g. ‘apt-get upgrade’  
According to the hostname, the matching root-password should be read from the ansible-vault file.  
I know that I can specify the decrypt password with “–ask-vault-pass”.  
But how to tell the Playbook to look for a certain id, get the password and performe the sudo ?

regards
