puppet node classifiers talk - patrick buckley
TRANSCRIPT
Brown
External Node Classifiers
with a dash of puppet and a hint of provisioning
Stages of provisioning
Initiate host requestHost initiatedHost up
Host contacts puppet masterPuppet master calls node_terminus
node_terminus creates node entry and configures groups
Puppet agent executes classes returned
Host ready
Initiate host removalHost removed from inventory service and infrastructure dependencies
Host shutdown
Puppet Dashboard
Groups && Classes
node_terminus
/etc/puppet/puppet.conf[master] node_terminus = exec external_nodes = /etc/puppet/puppet-dashboard/external_node
An external node classifier is an executable that can be called by the puppet master; it doesnt have to be written in any specific language. It's only requirement is that it returns a YAML document describing the node.
Example YAML
--- parameters: env: production puppet_version: 2.7.14 dashboard_version: 1.2.8classes: - puppet::master- users::ops- users::eng- puppet::dashboard- puppet::agentname: dashboard-demo.btrll.com
external_node
Puppet dashboard's out of the box external_node script is basically just/usr/bin/curl -k -H "Accept: text/yaml" "${ENC_BASE_URL}/${hostname}"
Since this script gets called before a list of a classes are applied to a host this enables us to configure the host in the enc before the first puppet run.function add_node { if [ $NOOP == true ] then echo "CMD: rake node:add name=$1 groups=$2" RESULT="NOOP" else RESULT=`cd /usr/share/puppet-dashboard; rake node:add name=$1 groups=$2 2>>$LOG` fi}
Wow, hold up a minute. Whats this rake task?
Dashboard rake/face*
Puppet Dashboard provides rake tasks that can create nodes, group nodes, create classes, and assign classes to nodes and groups. To get a full list of these tasks cd /usr/share/puppet-dashboard && rake -T. Here are a few excerpts
rake node:add # Add a new noderake node:classes # Add/Edit
class(es) for a noderake node:del # Remove a noderake node:groups #
Edit/Add groups for a noderake node:list # List nodesrake
node:parameters # Edit/Add parameters for a node
* There are murmurs about this functionality being ported to puppet faces. Faces being an api that allows you to extend the puppet command
Initiate Host Request
Host Initiated
Host contacts puppet master
Puppet agent contacts puppet masterMaster redirects to external node terminus
Node terminus classifys host based on dnsThis was chosen due to ease of setup
cat /etc/puppet/puppet-dashboard/classify.logTue May 22 23:34:28 UTC 2012 host:dashboard-demo.btrll.com env:production type:puppet-dashboard,puppet-master result:Node successfully create!
Host has been classified and returns the proper YAML (see earlier example)
Agent + Catalog + Report
Host has completed the puppet run and submitted a report. The delayed workers have processed the report.This is a recent change from older versions of the dashboard which processed reports synchronously.
Inventory Service
The inventory service allows you to easily access any facts you have configured for a host
Other hooks
Links/Questions
http://www.brightroll.com/job/http://apt.puppetlabs.comhttp://docs.puppetlabs.com/guides/external_nodes.htmhttp://docs.puppetlabs.com/dashboard/manual/1.2/rake_api.htmlhttp://puppetlabs.com/blog/puppet-faces-what-the-heck-are-faces/http://fog.io/1.3.1/index.htmlhttp://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/AESDG-chapter-instancedata.html?r=3741