Thank you for your answer.
Yes it works if I set ansible_ssh_user as variable in the inventory file,
but for my purpose it's the same as hardcoding it. What I want to do is to
share this with my colleagues, so they can also use it without making any
changes.
You can use this global variable in the playbook. As an example:
- name: Playbook to test default user
hosts: all
gather_facts: false
tasks:
- name: Print default users
debug:
var: ansible_user
When I run it with ansible-playbook test-default-user.yml --limit server1 I
get
ok: [server1] => {
"ansible_user": "foo.bar"
}
Also works with ansible_ssh_user. So I thought it's the same with the
inventory.
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/95a29b0b-3858-4118-bd27-796de7ebe2e3n%40googlegroups.com.