I installed puppet on a virtualhost to take it for a test drive. I am using the current version from epel, 2.6.18. This test installation will have the server and client running on the same system,for simplicity.
After installation of puppet, I ran puppet master --mkusers
to start the server. All good.
–configtest shows that my module directory is the default /etc/puppet/modules
folder.
I created the folder structure /etc/puppet/modules/ntp/manifests/, and then created a ntp.pp file as below:
class ntp {
package {'ntp':
ensure => present
}
service {'ntp':
ensure => running,
}
}
include ntp
Issuing puppet --parseonly /etc/puppet/modules/ntp/manifests/ntp.pp
returns clean. No errors.
Next, I issue
puppet agent --test --server=`hostname
And get back
info: Caching catalog for localhost.localdomain
info: Applying configuration version '1256130640'
notice: Finished catalog run in 1.23 seconds
I've confirmed that ntp is not already installed by checking with rpm -qa ntp
Issuing puppet --configprint all
confirms the above module path.
What am I doing wrong?
Best Answer
You are not using the correct file structure and naming convention for the Puppet autoloader to find and apply your module manifests correctly. Your
ntp.pp
should be calledinit.pp
and you should have a node definition for your server that hasinclude ntp
.Meaning you should have this kind of directory structure:
site.pp
:init.pp
:After that your
puppet agent --test
run should work as you expect.Your next stop is the Learning Puppet documentation: http://docs.puppetlabs.com/learning/index.html
Edit: Please note that Puppet 2.6.18 is ancient and has been end-of-lifed a long time ago. Even Puppet 2.7.x will reach EOL on October 1st. If you take Puppet for a test drive, please use the current Puppet 3.2.x series. Packages are available for every major OS and distribution, for RHEL/CentOS see http://yum.puppetlabs.com/.