Aha, sorry. I created an ~/.ansible.cfg file and placed the remote_user directive in it:
[defaults] remote_user=vagrant Then ran the command again: ansible-playbook -i inventory.yml box1.yml --extra-vars="ansible_ssh_user=vagrant" -vvvv --private-key=~/.vagrant.d/ insecure_private_key This time it worked! However, we run our ansible playbooks from a Tower host and have other jobs which don't run as that user, so this solution is not good if it sets it for all playbooks. As you mentioned ansible_ssh_user should override remote_user I tried setting remote_user to vagrant2 as a test, but the delegate_to command still tried to ssh as vagrant2 (so ansible_ssh_user=vagrant was not overriding it). Is there a way to set remote_user per playbook (or task?). Kind regards Andrew On Tuesday, February 2, 2016 at 1:39:24 PM UTC, Brian Coca wrote: > > remote_user is not a variable, its a directive, ansible_ssh_user would > override it anyways. > > > -- > Brian Coca > -- 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/ee1d60be-1b09-4116-b8dd-5c5b822c366f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
