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

Cheers,
*Kosala*




On Wed, Feb 7, 2024 at 6:06 PM Sakshi Jain <[email protected]> wrote:

> 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 ?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CANPH-qx%2B-xrrdsBJptr7TzcT_DaQrD6tJkjrqwqFRE8YJS7%3DDw%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CANPH-qx%2B-xrrdsBJptr7TzcT_DaQrD6tJkjrqwqFRE8YJS7%3DDw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAP7S5HZncRmX6rRbyRGLwdzzhFJ7HXYdxa4Na6sHGHvAZiNYxA%40mail.gmail.com.

Reply via email to