Deactivate node in PuppetDB via REST API

If you ever need to delete or deactivate (deactivate is a more appropriate word in PuppetDB context) a node in your PuppetDB, follow these steps.

First: List your nodes.

curl 'http://localhost:8080/v2/nodes'

Second: List details of your node you want to deactivate

curl 'http://localhost:8080/v2/nodes/<fqdn>'
{
  "name" : "<fqdn>",
  "deactivated" : null,
  "catalog_timestamp" : null,
  "facts_timestamp" : "2016-01-08T12:59:38.308Z",
  "report_timestamp" : null
}

 Third: Deactivate your node

curl -v -G -H "Accept: application/json" 'http://localhost:8080/v2/commands' --data-urlencode 'payload={"command":"deactivate node","version": 1,"payload":"\"<fqdn>\""}'

Fourth: Check

curl 'http://localhost:8080/v2/nodes/<fqdn>'
{
  "name" : "<fqdn>",
  "deactivated" : "2016-01-14T09:00:22.792Z",
  "catalog_timestamp" : null,
  "facts_timestamp" : "2016-01-08T12:59:38.308Z",
  "report_timestamp" : null
}

 

 

Make Puppet, Vagrant and Hiera play together

Testing your Puppet code locally with Vagrant is great. Fast and clean development and testing of your code can be done in this comfortable way. The base setup is easy:

  1. Download and install Vagrant
  2. Download and install VirtualBox
  3. Download and install Puppet

So far, so good. When it comes to Hiera, I was struggling around with a setup that actually uses Hiera data. I couldn’t convince Vagrant to notice my Hiera configuration. And so none of my keys and values inside my YAML files found their way into my Puppet manifests. vagrant provision puppet_dev  always failed with this error:

Continue reading