ansibleprivilegeselevated-privileges

What is the difference between ansible's remote_user & become_user


I need to understand the difference between ansible's remote_user & become_user considering that the play will either run locally or remotely.

Difference between:

- hosts: all
  become: yes
  become_user: user1

- hosts: all
  remote_user: user1

Will there be any difference incase ssh keys are setup between the servers ?

I tried to google for the differences but did not find any good explanation for the same.


Solution

  • Q: "Will there be any difference in case SSH keys are set up between the servers?"

    A: There will be no difference in privilege between

    - hosts: all
      become: yes
      become_user: user1
    

    and

    - hosts: all
      remote_user: user1
      become: no
    

    There might be a difference in the environment set for user1 between:

    Notes: