In group_vars/all.yml
I defined a default remote user:
ansible_user: blackknight
But in some cases I like to override that on the command line:
% ansible-playbook -u kingarthur test.yml
test.yml
is a simple debug playbook
- hosts: localhost
tasks:
- debug: var=ansible_user
when executing it tells me "ansible_user": "blackknight"
.
How should I change my variables or playbook to have a non-standard ansible_user
, but still allow it to specify on the command line (so that the command line option takes precedences over my default in the variables)?
-e
for not true for-u
. Feels odd to me that these two options behave so differently. Must be an ansible quirk. – MacFreek Oct 09 '19 at 08:23-e
> options > variables (from inventory, etc.). It's not specific to-u
. – muru Oct 09 '19 at 08:24-e
. I didn't look further when I discovered-u
) – MacFreek Oct 09 '19 at 08:26