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
}

 

 

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.