Deploying modules to single nodes and node groups

Once you define modules and nodes, you can start deploying the modules to your nodes. You can do this on various levels, which will be demonstrated in the following recipe.

How to do it…

In order to deploy a module (or manifest) to a node, your must configure this in the node's stanza or a group of nodes that the node belongs to, or you can define it on the base level to apply it to every node.

Configure to deploy a module or manifest to a single client

Edit the client configuration node from the previous recipe and add an include statement referring to manifest you want to be applied to the client block. You can execute the following command for this:

node 'rhel7-client.critter.be' {
  include ntp
}

Configure to deploy a module or manifest to a node group

In the same way you edited the single node file, edit the node group configuration file and add an include statement to the node group block referring to the manifest you want applied. Take a look at the following command:

node 'rhel7-client0.critter.be', 'rhel7-client1.critter.be', 'rhel7-client2.critter.be' {
  include ntp
}

Configure to deploy to all registered systems

One will typically have a node configuration file within /etc/puppet/manifests/site.pp/, or /etc/puppet/manifests/site.pp itself, if you work with one monolithic site definition, which affects all nodes. Edit /etc/puppet/manifests/site.pp/default.pp and enter the following code:

include ntp

Deploy to a system

On the system with the Puppet Agent installed, execute the following:

~]# puppet agent –-test

When executed, the following will appear:

Deploy to a system

There's more…

For testing purposes, there's an alternative to defining nodes and including modules.

Copy the manifest(s), files, and templates to your test machine (usually, you will develop elsewhere than the production Puppet Master anyway) and execute them in the following way:

~]# puppet apply /path/to/manifest.pp

Tip

By default, Puppet applies all manifests found in /etc/puppet/manifests/site.pp. As explained in the preceding section, this doesn't need to be a single monolithic file containing all your directives. When using it as a directory, it uses all the manifests found within this directory, or if the name of a subdirectory ends with .pp, it interprets all of its contents as manifests as well. It interprets all files alphanumerically.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset