Use Case
I'd like to filter nodes in the inventory with a plan and pass the node list to another plan as a targets list. For example:
bolt plan run inventory::filter variable=pp_role value=sandbox | \
bolt plan run example::foo -t-
The only value bolt plan run prints on stdout is the plan result value, which is always printed as JSON:
bolt plan run inventory::filter variable=pp_role value=sandbox
[...]
[
"node1.example.tld",
"node2.example.tld",
]
Describe the Solution You Would Like
With all the above in mind, the best solution is to teach bolt -t- to understand if JSON is given on stdin, I guess.
Describe Alternatives You've Considered
- Use
jq -r between bolt invocations to convert from JSON array to the plain text list.
- Use
--params=- instead of -t- and pass targets there.. Though, it makes passing other parameters to the 2nd plan much more complicated. One need to merge JSON documents for this.
Use Case
I'd like to filter nodes in the inventory with a plan and pass the node list to another plan as a targets list. For example:
The only value
bolt plan runprints on stdout is the plan result value, which is always printed as JSON:Describe the Solution You Would Like
With all the above in mind, the best solution is to teach bolt
-t-to understand if JSON is given on stdin, I guess.Describe Alternatives You've Considered
jq -rbetween bolt invocations to convert from JSON array to the plain text list.--params=-instead of-t-and passtargetsthere.. Though, it makes passing other parameters to the 2nd plan much more complicated. One need to merge JSON documents for this.