On 2/6/2017 7:42 AM, Brian Coca wrote:
> the distinction is easy, hostnames are only allowed when there is a ,
> . so if the string after -i does not have a comma, its a path.
I'm not so sure. The help for '-i' says
"specify inventory host path (default=/etc/ansible/hosts) or comma
separated host list."
How would it be possible to distinguish a comma separated host list
from a comma separated inventory host path list?
For example, would
-i a,b,c
be the hosts "a", "b", and "c", or the files (or directories) "a", "b",
and "c"?
A very quick glance at inventory/__main__.py(parse_inventory) makes me
think that the elements of the string are first checked to see if
they're a host, and then checked to see if they're a directory or file.
The presence of a comma in itself isn't enough to differentiate paths
an host. Of course, I just started reading Ansible source so I'm not
100% sure I have this right.
I was thinking that maybe requiring that host paths contain slash
characters, as part of either an absolute or relative path, would work.
Or maybe saying if the string argument to "-i" ends in a comma, then
the whole string would be considered a host list, but if it ends in
anything other than a comma, it would be a inventory host path list.
Anyway, thanks for your input.
Jon