Hi,

I seem to be having issues when remote_user is used in conjunction with 
ansible_ssh_user

For this playbook:

- hosts: tag_application_csds  tasks:
    - command: "whoami"      remote_user: deploy
      register: whoami
    - debug: var=whoami.stdout

with group_vars/tag_application_csds:

ansible_ssh_private_key_file: ~/.ssh/identity.ec2ansible_ssh_user: ubuntu

If I run $ ansible-playbook test.yml (no other arguments), I get:

ok: [1.1.1.1] => {
    "whoami.stdout": "ubuntu"
}

This despite the remote_user: deploy parameter on the task.

If delete the ansible_ssh_user parameter from the group_vars file and run $ 
ansible-playbook test.yml -u ubuntu, I get as expected:

ok: [1.1.1.1] => {
    "whoami.stdout": "deploy"
}

It seems like ansible_ssh_user overrides remote_user used in the playbook.

Is this desired behaviour? If so, it seems counterintuitive to me. If its a 
bug then I will lodge it.

On different, but related note, are there any benefits/differences in 
playbook behaviour when using remote_user than using sudo_user? Seems that 
for remote_user to work, the user must have credentials that allow it to be 
logged in from the terminal.

Thanks so much,

Steve

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/41cdc084-1c0c-41c5-994c-b6c5a45c8713%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to