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?

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

1 Answer 1

4

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .