You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following discussions of #17 and #12 I ran into a use case which I think would justify json output.
Turns out ansible supports dynamic inventories determined by invoking scripts, but needs the output of such a script to be in json format:
# ansible -i /etc/ansible/hosts.d/cumulus.sh --list-hosts all
[WARNING]: * Failed to parse /etc/ansible/hosts.d/cumulus.sh with script plugin: failed to parse executable inventory script results from /etc/ansible/hosts.d/cumulus.sh: needs to be a json dict
If I manually wrap a nodeattr invocation in json, I get what I want:
Such a -j option could either add a dummy name (like "hostlist") to the json, e.g.,
{ "hostlist": ["host1","host2","host3"] }
...or could possibly take a label as an argument: -j <listname>.
This isn't an urgent priority, but I thought it was a pretty clean example of how other hostname/genders utilities could be retrofitted with a single CLI switch to interact with newer frameworks.
The text was updated successfully, but these errors were encountered:
The more I think about it, the less I like the label argument; I think that could make lua-hostlist compatibility nightmarishly difficult. Still something to think about though.
Following discussions of #17 and #12 I ran into a use case which I think would justify json output.
Turns out ansible supports dynamic inventories determined by invoking scripts, but needs the output of such a script to be in json format:
If I manually wrap a
nodeattr
invocation in json, I get what I want:This would be a lot cleaner if I could use
hostlist
to postprocess:Such a
-j
option could either add a dummy name (like "hostlist") to the json, e.g.,...or could possibly take a label as an argument:
-j <listname>
.This isn't an urgent priority, but I thought it was a pretty clean example of how other hostname/genders utilities could be retrofitted with a single CLI switch to interact with newer frameworks.
The text was updated successfully, but these errors were encountered: