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.
The become_user means the user that will execute the playbook, and the remote user will execute it on the remote servers.
become: yes which will do a sudo to root automatically by default. But then you told it the remote_user: deployer which told the server that the user logging in is deployer and after they log in do the default sudo.
There are stable differences:
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:
sudo user1
anduser1@host
.Notes:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With