Sorry to revive an old thread but luckily, I came across this post only 
after banging my head against SSH connectivity issues for a couple of hours.

This ought to be documented somewhere but more importantly it makes sense 
to have the command line argument take highest precedence as that is the 
user's current explicit intent when he enters the username. It would also 
help with quicker debugging.


On Thursday, 26 December 2013 14:12:01 UTC+5, Gilles Cornu wrote:
>
> OK, I think I've catched it. I can reproduce the problem when I override 
> the remote user in the playbook file:
>
> - hosts: all
>   user: *root*
> *...*
>
> In my experience, the precedence rules for the applied ssh remote user are 
> following:
>
>    1. ansible_ssh_user in inventory file (or defined as extra 
> variable<https://github.com/al3x/sovereign/blob/b77bcdbb0c7fa7e66d4e51e17ed88ede56614fee/Vagrantfile#L32>
>    )
>    2. *user YAML attribute in playbook file (recently discovered ;-)*
>    3. -u / --user ansible-playbook argument (used by Vagrant provisioner)
>    4. ANSIBLE_REMOTE_USER environment variable
>    5. remote_user paramter in an ansible.cfg file
>    6. username of the current user
>
> At the moment, Vagrant behavior can therefore be shadowed by configuration 
> 1 and 2, which is the origin of this confusion. I'll re-open your pull 
> request to evaluate, which strategy makes more sense...
>

-- 
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/f9237aaf-c4c1-4192-81e5-1f1aa88a9af5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to