Creating a basic query application
We're going to start with a simple application to explore the PuppetDB API. This will get us acquainted with the basic tools that we need to access the API and extract data from it. Open your favorite editor and create a new file called basic_report.rb
.
The basic report application is going to be very straightforward and will simply pull back some basic details about a host using the facts
endpoint. This will demonstrate the basic techniques we're going to use to write a more fully featured application later on in this chapter.
Note
The code in this chapter has been designed to run against Ruby v1.9 and above, and it will throw errors if it's run on earlier versions. If you're using a RedHat-based distribution prior to RedHat Enterprise Linux 7, then you will almost certainly be running a version of Ruby 1.8. If you are running one of these operating systems, then I recommend that you use Ruby Version Manager (https://rvm.io) to install a more recent version...