so I am getting ansible setup and have a host configuration successfully setup via my ansible_hosts file:
104.236.59.171 ansible_connection=ssh ansible_user=root
checking the configuration status of the hosts I get:
104.236.59.171 | success >> {
"var": {
"hostvars['104.236.xx.xxx']": {
"ansible_connection": "ssh",
"ansible_user": "root",
"group_names": [
"ungrouped"
],
"inventory_hostname": "104.236.xx.xxx",
"inventory_hostname_short": "104"
}
}
}
However, the user/name on my local machine takes precedence over the ansible_user
variable which needs to be used for successful login.
I can override this with the -u
option in my ansible commands, but when I have more than one different users on multiple server instances and I am iterating over all of them, that will not be an option.
How do I go about overriding the default user obtained from my local machine?
Thanks for any help!