Query PuppetDB for Certain Facts
First off, my apologies if this has been asked/discussed in-depth before, but I can't seem to find out much about it myself. I'm trying to use cURL to query PuppetDB around some specific system facts. I get the jist of querying, but all examples/documentation I can find always has some conditional (i.e. something like OS == CentOS) in the query logic, which is not really what I'm looking for. Simply put, I'm looking to figure out what OSes, IP addresses, kernel versions, etc. are out there in my environment. I don't want to key off any certain value of a fact, but simply return the actual values of these facts for all nodes.
Does that make sense?
To put it another way, I want to obtain the following facts (in this sort of logical structure) from PuppetDB:
node01: ipaddress: 188.8.131.52 operatingsystem: RedHat kernel: 2.6.18-123 node02: ipaddress: 184.108.40.206 operatingsystem: CentOS kernel: 3.10.0-2
...and so on. Any help or insight is greatly appreciated.
Just a quick follow-up question, is there a good way to ensure all facts are returned in the same order for all nodes? I ask, as I get different ordering for different nodes at different times, which makes parsing the output a little more difficult.
Here's an example:
# puppet query facts --render-as yaml '(fqdn~".*")' --facts ipaddress,kernel,operatingsystem,operatingsystemrelease svr01: operatingsystemrelease: "7.0.1406" kernel: Linux operatingsystem: CentOS ipaddress: "10.170.106.250" svr02: operatingsystemrelease: "7.0.1406" kernel: Linux ipaddress: "10.170.111.155" operatingsystem: CentOS svr03: ipaddress: "10.44.6.24" kernel: Linux operatingsystemrelease: "6.6" operatingsystem: RedHat svr04: kernel: Linux operatingsystem: CentOS operatingsystemrelease: "6.6" ipaddress: "10.170.111.13"
It would be very nice if they all were displayed in the order they were asked for with --facts. Thanks!