Shouldn’t --user on command line overwrite ansible_user?

10 views
Skip to first unread message

Kai Stian Olstad

unread,
Mar 3, 2017, 3:17:32 AM3/3/17
to Ansible Project
Hi

In the host_var file for the server I have ansible_user set like this.

$ cat host_vars/u1.yml
---
ansible_user: ansible


Sometimes I would like to use an another user for some ad hoc commands,
but -u/--user is ignored

$ ansible u1 -a id -vvvv -u user1
Loaded callback minimal of type stdout, v2.0
<192.168.122.106> ESTABLISH SSH CONNECTION FOR USER: ansible


Shouldn’t -u/--user overwrite ansible_user variable?

Or is -e/--extra-vars the only way?

$ ansible u1 -a id -vvvv -e ansible_user=user1
Loaded callback minimal of type stdout, v2.0
<192.168.122.106> ESTABLISH SSH CONNECTION FOR USER: user1


--
Kai Stian Olstad
Reply all
Reply to author
Forward
0 new messages