Book Image

Extending Puppet

By : Alessandro Franceschi
Book Image

Extending Puppet

By: Alessandro Franceschi

Overview of this book

Table of Contents (21 chapters)
Extending Puppet
About the Author
About the Reviewers

How Puppet code may change in the future

Now, hold on, stop to read, and think again about what we've seen in this chapter and particularly in the last section. Variables that define our infrastructure can be dynamically populated according to the number of hosts that have specific classes or resources. If we add hosts with these services, they can be automatically used by the other hosts.

This is what we need to configure with Puppet dynamic and elastic environments, where new services are made available to other nodes that are consequently configured.

For example, we can set a variable that returns all the IP addresses of the nodes that have Apache installed:

$web_servers_ip = query_nodes('Class[apache]', ipaddress)

This variable can be used in an ERB template that configures a load balancer. This is a simple case that probably doesn't fit real scenarios where we probably have different Apache web servers doing different tasks on different servers, but it can give us an idea.

In other cases...