2

I'm currently in reorganising the structure of my puppet code to a model, which uses, profiles and roles.

I've started with profiles and was testing, but already run into issues :/

In my node definition I do the following:

node 'dev.server' {
  include profile::php
}
# modules/profiles/manifests/php.pp
class profile::php {
  include apache::mod::php
  class{ 'php': }
  php::module { "mcrypt": }
  php::module { "mysql": }
  php::module { "gd": }
}

When I run the puppet agent on the node I get the error

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate declaration: Class[Profile::Php] is already declared; cannot redeclare at /etc/puppet/environments/production/modules/profile/manifests/php.pp:5 on node

However, when I rename the profile to profile::php2 it's working. What's causing the issue that it's already declared?

  • ` class{ 'php': ensure => 'present', }` - What is the purpose of this? Did you mean package{'php':...}? – Zoredache Mar 5 '14 at 8:54
  • nope, i want to include the class. Sorry, I've fixed it. The ensure was wrong here – paul.tw Mar 5 '14 at 8:57
4

Changing class{ 'php': } to class{ '::php': } (note the double colon before php) fixed it.

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.