Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Puppet unresponsive nodes list
# I'm sure there is a more ruby way of doing this
# house keeping
mv puppet.dead puppet.dead.old
# get a list of all the unresponsive nodes
/opt/puppet/bin/rake -f /opt/puppet/share/puppet-dashboard/Rakefile node:unlist >> puppet.dead
#deactivate unresponsive nodes
cat puppet.dead | xargs -I {} puppet node deactivate {}
# clean unresponsive nodes
cat puppet.dead | xargs -I {} puppet node clean {}
# remove unresponse nodes from db and puppet console
cat puppet.dead | xargs -I {} /opt/puppet/bin/rake -f /opt/puppet/share/puppet-dashboard/Rakefile node:del['{}']
# Puppet command line(CLI) tool to list unresponsive nodes.
# Add this to the `/opt/puppet/share/puppet-dashboard/lib/tasks` directory.
# `rake node:unrelist` to show all unresponsive nodes by name.
# Copied and modified from original Puppet `node:list` rake task.
$: << File.dirname(__FILE__)
require 'rake_helpers'
namespace :node do
desc 'List unresponsive nodes'
repeatable_task :unrelist, [:match] => :environment do |task|
names =
regex = task.get_parameter(:match)
names.grep(/#{regex}/).map{|n| puts n}

balunia commented Nov 23, 2015

It's so easy now, tahnk you :)


todgru commented Feb 7, 2017

A newer version written in Ruby for PE 2016 can be found here:
The Ruby code is simple enough that a bash script could implement the same thing. Just use curl ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment