0

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?

  • Do you have a node definition for the system you're trying to provision? If not, does creating one change this behavior? Lastly, can you post your Puppet config? I'm particularly interested in whether you're running multiple environments. – jgoldschrafe Aug 29 '13 at 22:24
  • I've never used puppet before today - purely a learning exercise and there is only one machine involved. – a coder Aug 30 '13 at 1:58
2

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 called init.pp and you should have a node definition for your server that has include ntp.

Meaning you should have this kind of directory structure:

$ tree /etc/puppet
/etc/puppet
├── manifests
│   └── site.pp
└── modules
    └── ntp
        └── manifests
            └── init.pp

site.pp:

# cat /etc/puppet/manifests/site.pp
node somenode {
    include 'ntp'
}

init.pp:

# cat /etc/puppet/modules/ntp/manifests/init.pp 
class ntp {
  package { 'ntp':
    ensure => present
  }
  service { 'ntp':
    ensure => running
  }
}

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/.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.