Understanding Ansible remote user

I am sure that this is probably a silly question, but It’s the basis for the preparation for Ansible certification exam. I have troubles with the understanding of the Ansible remote_user.

Let’s imagine that you have a control node and a managed host to perform some action, the users in both nodes are as follows:

Control node → ROOT, User1 , User2, User3

Managed Host → ROOT, User3

So, if you are logged as ROOT in the control node, and you execute a playbook to perform some action in the managed host, and you use the key words REMOTE_USER = User3, are you using your control’s node User3 to perform the action within the managed host? OR are you loginng as managed host’s User3 to perform the action?

Hope you can help me… as I was not able to find anything clear in the documentation.

Thank you in advance!!!

'remote_user' is 'loginng as managed host's User3'

See
https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html#intro-to-playbooks

Ansible will login to the managed host user3. It will do

ssh User3@managed-host /some/random/ansible/path/to/a/ansible/python/script

To see what ansible is actullay doing you can add -vvv to the ansible and ansible-playbook and you will get a more detail output of all the ssh commands ansible is running.

Thank you so much to both of you :slight_smile:

The fact is that I started doubting about this basic concept when I tried to create a new USER4 in the managed host, and I faced several troubles to connect as USER4 (remote_user).
Despite of exchanging the SSH Pub Keys I still facing the PERMISSION DENIED error, but this belongs to another thread…

Thank you!