I don’t know how to deal with this.
I have a list of IPs and I want to use ansible_ssh_host var to give a short name to a given IP address but I want to use an inventory script like this:
“group1”: {
“hosts”: [“host1”, “host2”],
“vars”: { “ansible_ssh_host”: “xxx.xxx.xxx.xxx” }
}
This way I can only set ssh_host per group not per host and I noticed that it is affecting both hosts.
Is there any way to do this with the inventory script json API?
Thanks
Yes, when the inventory script is called with --host hostname it can return JSON for a specific host.
(There is a RFE open to implement a way to return these in the main return, eliminating the need for the script to make additional calls, but we’ll support both forms indefinitely)
http://www.ansibleworks.com/docs/api.html#example-the-cobbler-external-inventory-script
Thanks, I can do it that way.
RFE? it’s an open issue? Would be great to save the second roundtrip