Pulling Strings With Puppet - James Turnbull [55]
Tip - You can also ignore some files located in your plug-in source directory; for example, by default any . svn directories are ignored, using the pluginsignore configuration option.
DISTRIBUTING TYPES AND FACTS IN VERSION 0.24
In the forthcoming 0.24 release of Puppet, an additional distribution mechanism for custom facts and types will also be available. To make use of this method, custom facts and types are now stored in one or more modules. Types and facts associated with particular modules are stored in the associated module. They are then gathered together and distributed via a file server mount called plugins. This method has also been previously used in some patched Debian packages released by Matt Palmer.
If your custom facts and types are not specific to particular modules, you can create a catch-all module to distribute them. I recommend calling this module custom. To enable the new pluginsync functionality, we need to make some changes on both the master and our clients. First we need to configure our plugins file mount in the fileserver. conf configuration file. If you already have a plugins mount, all you need to do is remove the path statement from the mount definition. This turns the existing user-defined plugins mount into the required system-defined mount. Your resulting mount should look like this:
Here we've defined the plugins mount and allowed clients from the testing. com domain to connect and retrieve custom types and facts. Next, we need to create our required module and directory structure. We're going to create the custom module to hold our types and facts. We're going to assume our modules directory is /etc/puppet/modules (defined using the modulepath configuration option).
You place your custom types in the type directory and your custom facts in the facter directory. If a particular custom type or fact belongs to an already existing module, create the required plugins/puppet and plugins/facter directories and install your types and facts in them.
Now, on your Puppet clients, you need to configure pluginsync and, if you have it enabled, turn off factsync as it is no longer needed. You also need to configure the pluginsource option to point to the plugins mount on the Puppet master server.
You can find some more information on this distribution method at http://reductivelabs.com/trac/puppet/wiki/PluginsInModules.
Resources
• Instructions for adding custom facts:
• Documentation on how to create custom types:
• A complete example of resource type creation:
• Documentation on detailed provider development:
• Practical set of documentation covering type development:
• Writing your own functions:
Table of Contents
About the Author
About the Technical Reviewer
Acknowledgments .......................................................xiii
Introduction
CHAPTER 1 Introducing Puppet ............................................. 1
What Is Puppet?
How Does Puppet work?
A Declarative Language
A Transactional Layer
The Future for Puppet
Web
Installing and Running Puppet
Installing Ruby
Installing Ruby and Ruby Libraries from Packages
Installing Facter
Installing Facter from Package
Installing RDoc
Installing Puppet
Installing Puppet by Package
Installing Puppet from a Ruby Gem
Getting Started with Puppet
Starting the Puppet Client
Signing Your Client Certificate
Running the Puppet Daemons
The [main] Configuration Namespace
Configuring puppetmasterd
Configuring puppetd
Configuring puppetca
Resources .............................................. 40
Speaking Puppet
Defining Configuration Resources
Resource Attributes
Resource Style
Resource Defaults
Collections of Resources
Classes Relationships
Class Inheritance
Definitions
Qualifying Definitions
Variable Scoping
Variables and Class Inheritance
Qualified Variables
Variables and Metaparameters
Arrays
Conditionals
Creating Nodes
Node Inheritance