Chapter 7. Controlling Puppet

If you are using Puppet, you will be quite happy with the level of control MCollective gives you. MCollective can allow new ways of using Puppet that simply aren’t possible from agent, cron-run, or even command-line usage of Puppet.

Install the Puppet Agent

The first thing we need to do is install the MCollective Puppet agent. Installation of this is identical to the agents we installed in Chapter 4 above. Since we know you have Puppet installed, we’ll dispense with the command line installation and show you to do it with Puppet.

node nodename {
  mcollective::plugin::agent  { 'puppet': }  # for servers
  mcollective::plugin::client { 'puppet': }  # for clients

If you use Hiera you can install the agent with a simple listing of the puppet agent in the mcollective::plugin::agents array. In this example we’re going to show you an example where we set the puppet agent dependencies to ensure that puppet client is installed on the host.

    version: latest
      - Package[%{hiera('puppet::client::package_name')}]
      - Service[%{hiera('puppet::client::service_name')}]

    version: latest


Obviously a bit redundant since Puppet is enforcing this policy so we already know that it is installed, but this makes for a good example since the mcollective agent for puppet can’t function without puppet installed.

Checking Puppet Status

Once you have installed the agent and restarted mcollectived (which ...

Get Learning MCollective now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.