# ansible configuration

**URL:** <https://forum.ansible.com/t/ansible-configuration/38681>\
**Category:** Ansible Project\
**Created:** [February 7, 2024, 5:05am UTC](https://forum.ansible.com/t/ansible-configuration/38681 "2024-02-07T05:05:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sakshi\_Jain](https://avatars.discourse-cdn.com/v4/letter/s/ecccb3/32.png) [@Sakshi\_Jain](https://forum.ansible.com/u/Sakshi_Jain)\
**Post date:** [February 7, 2024, 5:05am UTC](https://forum.ansible.com/t/ansible-configuration/38681/1 "2024-02-07T05:05:57Z")

</div>

So basically two users

User1 , user2 user is a sudo user

There are 5 servers : server1 , server2 , server3, server4, server5

We need password less connection from server1 to all other servers

I am facing issue with key password less authnetication

Tha playbook are be executed as sudo user that I have mentioned in the playbook as  
become: yes

become\_user : user2

I have copied the public key ~/.ssh/id\_rsa.pub of user2 from server1 to ~/.ssh/authorized keys in all the other servers

But its not working

I am able to login with user1 and user2 from server1 to server2 to all the servers

But when I am trying to execute the playbook it throws error

I have tried to mention ansible\_user= user1 in the inventory

What shall I do ?

---

<div class="post-metadata">

**Author:** ![Kosala\_Atapattu1](https://avatars.discourse-cdn.com/v4/letter/k/7feea3/32.png) [@Kosala\_Atapattu1](https://forum.ansible.com/u/Kosala_Atapattu1)\
**Post date:** [February 7, 2024, 5:18am UTC](https://forum.ansible.com/t/ansible-configuration/38681/2 "2024-02-07T05:18:00Z")

</div>

Sounds like what you’re looking for is to run Ansible through a bastion. Have you checked out:  
[https://www.jeffgeerling.com/blog/2022/using-ansible-playbook-ssh-bastion-jump-host](https://www.jeffgeerling.com/blog/2022/using-ansible-playbook-ssh-bastion-jump-host)

Cheers,

---

<div class="post-metadata">

**Author:** ![Sakshi\_Jain](https://avatars.discourse-cdn.com/v4/letter/s/ecccb3/32.png) [@Sakshi\_Jain](https://forum.ansible.com/u/Sakshi_Jain)\
**Post date:** [February 7, 2024, 5:24am UTC](https://forum.ansible.com/t/ansible-configuration/38681/3 "2024-02-07T05:24:22Z")

</div>

also while executing the playbook from server1 , shall we execute as user1 or user2 ?  
and in inventory shall i mention as user1 or user2  
as in playbook, it needs the privileged permission from the sudo user
