15
votes

just starting with Puppet, really new to this world.

I have

  • CentOS 6 Puppet Master
  • CentOS 6 Puppet Client

In Master have one module:

 puppet module list
/etc/puppet/modules
âââ mstanislav-yum (v1.0.0)

So I want to apply same module to my puppet client but I can't or I don't know why

root@puppetclient: puppet agent --test
Info: Retrieving plugin
Info: Caching catalog for puppetclient
Info: Applying configuration version '1355737643'
Finished catalog run in 0.10 seconds

but there are not any changes to the client :-/

Any idea?

10

10 Answers

13
votes

You haven't declared the module (assigned it to your node) yet...

Add this to site.pp:

node 'fqdn of client' {
  include yum
} 

Then, you can run puppet agent -t to see it in action.

4
votes

you can use the following command to view the details output

puppet agent --test --trace

2
votes

Try to use Hiera and yaml files, I think it is much more flexible and better organised.

Edit the site.pp file:

node "default" {
    hiera_include('classes')
}

After that you can call the classes in every of the specific node.yaml file with simple:

classes:
  -class1
  -class2

I am using it on Ubuntu, works fine.

1
votes

You could try the --noop mode (dry run mode).

puppet agent --server=YOUR_PUPPET_SERVER_NAME --onetime --no-daemonize --verbose --noop

This would show up the changes that it should have done, but physically won't change anything. Removing --noop will do all those changes.

Check the doc for explanation of other options in the above command. http://docs.puppetlabs.com/man/agent.html

1
votes

The two main ways to apply a module to a node are to add one of the following to site.pp

node 'node <certname> (normally the fqdn)' {
    require <module name>
}

or

node 'node's <certname>' {
    include <module name>
}

Then run in the node puppet agent --test

require is like include but it creates dependency relationships and allows the same classes to declared more than once which is good if you want overlapping role classes.

1
votes
  1. First install the module from puppet forge
  2. Open site.pp and add the following lines
node default {
       # include module_name
         include apache
}

Then run the following on you puppet agent.

sudo puppet agent --test

1
votes

If you have added the node declaration in another location that isn't site.pp (which is the recommended way to do it) then remember to add the "import" config to site.pp which would reference the node manifest.

This is how my config looks like. Main manifest DIR with nodes DIR and site.pp file:

drwxr-xr-x. 3 root root 4096 May 19 07:23 nodes
-rw-r--r--. 1 root root   62 Jun  4 16:31 site.pp

This is the node declaration in my nodes DIR:

node 'fqdn of client' {
  include yum
} 

Finally, site.pp in the main manifest DIR would import the node as follow:

import 'nodes/*.pp'

node default { }
0
votes

You must create a node definition that contains an 'include' of the class that you want to apply.

0
votes

Run

puppet apply -e "include mstanislav-yum"

if you want to run the module on its own, though it is more usual to include a node definition in your site.pp manifest.

0
votes

Live example from my production:

node 'client.io' {

class { '::selinux':
mode => 'disabled',
type => 'targeted',
}

class { 'zabbix::agent':
server => '192.168.245.11',
serveractive => '192.168.245.11',
}

include firewall
include mysql::server

}