I'm new to using PQL and i'm having a bit of difficulty. I'm trying to return the ipaddress of any node where the value of three trusted facts (pp_application, pp_role and pp_environment) meets some criteria.
I have a query which will return only the nodes that i care about, but I'm having a problem structuring the query to also return the top level ipaddress fact with the results. Any help would be appreciated. Thank you.
$test_query = '["from", "facts",
["and",
["subquery", "fact_contents",
["and",
["~>", "path", ["trusted", "extensions", "pp_application"]],
["=", "value", "someapp"]]],
["subquery", "fact_contents",
["and",
["~>", "path", ["trusted", "extensions", "pp_role"]],
["=", "value", "appserver"]]],
["subquery", "fact_contents",
["and",
["~>", "path", ["trusted", "extensions", "pp_environment"]],
["=", "value", "development"]]]]]]'
$test_results = puppetdb_query($test_query)
Notify { '*** query results ***\r':
message => "data: ${test_results}",
}