Online Book Reader

Home Category

Pulling Strings With Puppet - James Turnbull [44]

By Root 382 0

You are not limited to the provided report processors either. Puppet also allows you to create your own report processors. There are two methods for this. The first method is to use the existing store reports, which are YAML files, and write an external report processor to make use of this information, for example, graphing it or storing it in an external database. These external report processors are usually written in Ruby to take advantage of Ruby's ability to deserialize YAML files and make use of the resulting objects.

The second method involves writing your own report processor and adding it to Puppet. The report processors are stored in the lib/puppet/reports directory. On a Debian host, we'd add our custom report processor to the /usr/local/lib/site ruby/1.8/puppet/reports directory with the existing report processors. We would then specify the new report in the reports configuration option.

The existing report processors make excellent templates for new processors. In Listing 5-3, you can see the Ruby code for the log report processor.

It's very easy to create your own based on this template. First, you need to require Puppet by specifying require 'puppet'. Then you simply call the Puppet: : Network: : Handler. report. newreport function and specify the name of the new report processor you are creating, for example:

Puppet::Network::Handler.report.newreport(:mysql) do

Include a desc to describe the report processor and then specify the functionality of your report processor.

Resources

• Details of available reports and reporting fitnctionality:

• Reference page detailing reports and their structure:

CHAPTER 6

Advanced Puppet

In previous chapters, I have introduced you to Puppet and how to use it. In this chapter, we're going to look at some important advanced features available in Puppet. Specifically, we're going to look at three features: external nodes, LDAP nodes, and some methods for enhancing Puppet's scalability.

External nodes provide the capability to store our node definitions in a data source external to Puppet, for example, generated by a script or drawn from a database. An extension of this functionality, LDAP nodes, allows you to store your node configurations in a LDAP server. This externalization of data provides a number of advantages when managing our configuration information, especially in providing a single source of truth and a centralized repository for asset and configuration information.

As discussed in Chapter 1, the Puppet client-server model is not yet fully scalable to large installations, for example, the management of thousands of nodes. In this chapter, I'll examine using the Mongrel web server in combination with an Apache proxy running the mod_ssl and mod_proxy_balancer modules to enhance Puppet's scalability and allow you to run multiple master daemons.

External Node Classification

External nodes are node definitions stored externally to Puppet. To use external nodes, you need to construct a script that takes a hostname as an argument and returns information about that host. These scripts are known as classifiers. The information returned should be the classes that are to be included in the node and any variables we want to set.

Tip - Puppet external nodes override node definitions in your manifest files. If you define external node classification, you must define all nodes in your node classifier.

To function correctly, the script must return the data in the form of a YAML hash, and the script must end with a zero exit code. A nonzero exit code will result in the configuration not being applied. The YAML hash can contain either classes or parameters or both.

To use external nodes, we first need to tell Puppet to use a classifier script to configure our nodes. To do this, we specify the script in the external-nodes configuration option in the [main] section of our puppet.conf file as you can see in Listing 6-1.

In Listing 6-1, we've specified a classifier script called puppet_node_classifier located in the /usr/bin directory.

In the forthcoming

Return Main Page Previous Page Next Page

®Online Book Reader