Ask Your Question

Revision history [back]

One solution seems to be to have the same profile in each role and to declare it with class and not include.

Example:

class role::A {
  class { '::profile::common': }
  include '::profile::A'
}

and

class role::B {
  class { '::profile::common': }
  include '::profile::B'
}

If a node is declared with both role::A and role::B, this will result in a nice error during the Puppet run.

node localhost {
  include '::role::A'
  include '::role::B'
}
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate declaration: Class[Profile::Common] is already declared in file /etc/puppet/modules/role/manifests/A.pp:2; cannot redeclare at /etc/puppet/modules/role/manifests/B.pp:2 on node localhost
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run