Understanding Ansible remote user

24 views
Skip to first unread message

Vicente Domínguez

unread,
Oct 7, 2019, 12:00:51 PM10/7/19
to Ansible Project

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!!!!

Vladimir Botka

unread,
Oct 7, 2019, 12:27:39 PM10/7/19
to Vicente Domínguez, ansible...@googlegroups.com
On Mon, 7 Oct 2019 09:00:51 -0700 (PDT)
Vicente Domínguez <vi1...@gmail.com> wrote:

> 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?

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

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

Kai Stian Olstad

unread,
Oct 7, 2019, 12:30:35 PM10/7/19
to ansible...@googlegroups.com
On 07.10.2019 18:00, Vicente Domínguez wrote:
> 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?

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.

--
Kai Stian Olstad

Vicente Domínguez

unread,
Oct 7, 2019, 1:02:39 PM10/7/19
to Ansible Project
Thank you so much to both of you :)

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!
Reply all
Reply to author
Forward
0 new messages