Puppet RESTful API
To offers the communication between the Puppet master and agents, Puppet uses RESTful APIs. The URL to access the RESTful API is:
Security
Puppet typically handles the security and SSL certificates related management task. Still, when attempting to connect to a system, if you want to apply the RESTful API exterior of the cluster, then you have to handle the certificate on your own. To configure the security policies for Puppet, use the auto-config file.
Testing REST API
To test the RESTful API connectivity, we can use the curl utility. Let’s see an example to retrieve the catalog of a node using REST API curl command:
In the next series of commands, we are going to set up an SSL certificate. It depends on the location of the SSL directory and the node name used. For example, consider the following command:
The above command sends a header that is used to define the format to return and a RESTful URL to create a catalog for brcleprod001 in a production environment and produces the given output:
--- &id001 !ruby/object:Puppet::Resource::Catalog aliases: {} applying: false classes: [] ...
Let’s consider another example, to get a CA certificate from a Puppet master. There is no need to be authenticated with its own signed SSL certificate. This is necessary before you can be authenticated.
Puppet Master and Agent Shared API Reference
Puppet Master API Reference
Authenticated resource (requires a valid signed certificate).
Catalogs
Certificate Revocation List
Certificate Request
Submit a Report
Node ? Facts Regarding a Specific Node
Status ? Used for Testing
Puppet Agent API Reference
When you add a new agent on the machine, then by default, the Puppet agent does not listen for HTTP requests. Manually we have to enable it. Copy the following line in the puppet.conf file:
Now, the Puppet agent can listen for HTTP requests.
Facts
Run – Update the client like a puppetturn or puppet kick.