The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

This issue tracker is now in read-only archive mode and automatic ticket export has been disabled. Redmine users will need to create a new JIRA account to file tickets using https://tickets.puppetlabs.com. See the following page for information on filing tickets with JIRA:

Feature #5795

There should be a Node Terminus that uses a local YAML file like an External Node Classifier.

Added by Jared Brothers over 5 years ago. Updated over 1 year ago.

Status:Needs More InformationStart date:01/06/2011
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:node
Target version:-
Affected Puppet version: Branch:
Keywords:node terminus

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com

This ticket is now tracked at: https://tickets.puppetlabs.com/browse/PUP-3918


Description

I wrote a node terminus that pulls the node data from a local file (/etc/puppet/node.yaml) in the same format as the external node classifier. I use this in order to do experiments on a single node by running stand-alone puppet, in an environment that usually uses an external node classifier. With a local copy of the node classifier output, and a local copy of the manifests, my development cycle is: edit the node.yaml, edit the manifests, run puppet, repeat; then merge working changes up. I also use this for entirely stand-alone hosts, such as Amazon EC2 instances launched with an external node classifier Yaml file passed as User Data.

Local Yaml node terminus: https://github.com/brothers/puppet/commit/251e46cadc8d366404c74d1195b874f55a2a0b66

I also wrote an mcollective client/agent pair to execute the classifier and copy the output to a local file on the node.

Local Yaml client/agent: https://github.com/brothers/mcollective-plugins/commit/59ecd42fa8c9051f5f0abc83ee10d7ba445b5f57

I would like to receive feedback on this, before I clean it up and write tests for it.

History

#1 Updated by James Turnbull over 5 years ago

  • Status changed from Unreviewed to Needs More Information

This is really cool – can you show me an example of how the API looks using curl or the like?

How are you passing the user data to EC2?

Also:

# Load node from local YAML
 file = "/etc/puppet/node.yaml"
 

I’d make this a Puppet configuration option in defaults.rb with a default setting.

#2 Updated by Jared Brothers over 5 years ago

Can you show me an example of how the API looks using curl or the like?

I have an init script on my images that downloads userdata to node.yaml, pulls manifests with git, and runs puppet.

curl -o /etc/puppet/node.yaml http://169.254.169.254/2009-04-04/user-data
puppet --node_terminus=localyaml --modulepath=$MODPATH /etc/puppet/manifests/site-$SUBSITE.pp

How are you passing the user data to EC2?

You can pass the yaml to the run_instances method at launch time, using the API or the cli tools.

I’d make this a Puppet configuration option in defaults.rb with a default setting.

Thanks for the pointer.

#3 Updated by Jared Brothers over 5 years ago

Added configuration option with default: https://github.com/brothers/puppet/commit/5824a36fbc45d325eb41f07c00269bf0a4b50de5

#4 Updated by Nigel Kersten over 5 years ago

I think I’d rather see us put this work into the existing yaml terminus which should look in clientyamldir for a node definition when not running as a master.

What version of puppet have you been running? I assume it’s 0.25.x?

#5 Updated by Jared Brothers over 5 years ago

Yes, I am using 0.25.5 on CentOS 5.5, planning to upgrade to 2.6 real soon.

If I copy the output of my external node classifier to /var/lib/puppet/client_yaml/facts/$fqdn.yaml, then stand-alone puppet should work?

#6 Updated by Nigel Kersten over 5 years ago

I think so, yes.

The bit where I’m unsure is that in 2.6.x where we’ve moved to using “puppet agent” “puppet apply” etc, we appear to have lost some functionality you’re making use of in 0.25.x

Can I clarify that you’re just running:

puppet --node_terminus=localyaml --modulepath=$MODPATH

and this is working without having to specify a .pp file ? I don’t think this works anymore in 2.6.x with “puppet apply” (the replacement for ‘puppet’).

#7 Updated by Jared Brothers over 5 years ago

No, I left out the entry point site-$SUBSITE.pp, which I thought was incidental complexity.

#8 Updated by Nigel Kersten over 5 years ago

brilliant :) I was worried we’d lost functionality.

In that case I’d definitely rather we worked on the yaml node terminus so that it did what you need. A quick test shows it doesn’t currently work out of the box, even though the code seems to hint at it.

https://github.com/puppetlabs/puppet/blob/master/lib/puppet/indirector/yaml.rb#L46

#9 Updated by Matthias Saou over 1 year ago

Redmine Issue #5795 has been migrated to JIRA:

https://tickets.puppetlabs.com/browse/PUP-3918

Also available in: Atom PDF