Online Book Reader

Home Category

Pulling Strings With Puppet - James Turnbull [17]

By Root 347 0
to have multiple master servers use a single certificate authority. At the moment this isn't fully supported, but you can read about it at http://reductivelabs.com/trac/puppet/wiki/MultipleCertificateAuthorities.

Resources

We've looked at installing and configuration Puppet in this chapter, and there are a number of useful resources and documentation online that can also help with this process.

You can also log tickets and bug reports at Puppet's trac site by registering at http://reductivelabs.com/trac/puppet/register.

Web

• Puppet support:

• Puppet installation guide:

• Puppet configuration reference:

Mailing Lists

• Puppet user mailing list:

CHAPTER 3

Speaking Puppet

In Chapter 2, we installed the Puppet master daemon and a Puppet client, and connected our first node to the master. In the process of connecting that first node, we also created a basic site manifest in the site. pp file. Our first manifest was simple and set the user and group ownership and the permissions of the /etc/passwd file. But Puppet is capable of much more than simply setting the permissions of a single file. It can install packages, ensure services are configured correctly and started (or stopped), configure applications, and perform numerous other functions.

To carry out such tasks, Puppet uses a powerful declarative language that can describe the required configuration in platform-independent terms. The language is then compiled by the Puppet master and delivered to the client that in turn applies the configuration to the target node.

In this chapter, we're going to delve into Puppet's language and demonstrate how to configure a variety of items and make best use of it to manipulate your nodes. By the end of the chapter, you should have a good understanding of how the Puppet language is syntactically structured. We'll also talk about some language conventions to make your Puppet manifests easier to read and understand.

Throughout this chapter, I also will recommend a number of style guidelines for Puppet syntax. These guidelines have developed in the Puppet community, and the use of them will make it easier for others to understand your configurations. You can see a Puppet style guide athttp://www.reductivelabs.com/trac/puppet/wiki/StyleGuide.

Caution -* This chapter is correct at the time of writing and represents an explanation of the core of the Puppet language. But Puppet is a growing and developing language. Syntax changes, new grammar is introduced, and new functionality developed. I recommend you regularly check the Puppet web site and the documentation for updates.

Defining Configuration Resources

The basic configuration declaration in Puppet is called a resource. Let's take another look at the contents of the manifest file we created in Chapter 2. You can see it repeated in Listing 3-1.

Listing 3-1 is a simple example of a Puppet configuration resource. Resources are configuration items you want to manage on your nodes. Resources could include items like files, services, cron jobs, users, and groups. Each resource is made up of a type, a title, and attributes.

Let's break Listing 3-1 down. The first statement, file, is the resource type. The resource type indicates the type of configuration resource you want to manage on your node, in this case files. Each type has its own set of attributes; for example, the mode attribute is used by the file type to set file permissions. There are also some special attributes, called metaparameters, which can be applied to all resource types.

After we've specified our resource type, we open a set of curly braces. These braces will hold the resource title and attributes.

Resource Titling

The resource title is the field before the colon in our resource. In Listing 3-1, the title is "/etc/passwd"; in this case, it is also the literal path to configuration item being managed. The resource title is used by Puppet to refer to resources in other parts of your configuration.

Tip - I recommend enclosing all resource titles in double quotes to ensure they are correctly

Return Main Page Previous Page Next Page

®Online Book Reader