Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am writing particular modules for the different roles of my servers. So I have a puppet and a puppet-dashboard-Module. The puppet module ensures that puppet is correct installed. The puppet-dashboard does the same for the puppet-dashboard, off course.

Both modules need the puppetlabs apt source (btw. I am using So I have the following defined resource in puppet and puppet-dashboard-module:

    apt::source { "puppetlabs":
      location          => "",
      release           => "squeeze",
      repos             => "main",
      required_packages => true,
      include_src       => false,
      key               => "4BD6EC30",
      key_server        => "",

Now I get the following error on my agent:

err: Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate declaration: Apt::Source[puppetlabs] is already declared in file /etc/puppet/modules/puppet/manifests/base.pp at line 27; cannot redeclare at /etc/puppet/modules/puppet-dashboard/manifests/init.pp:42 on node server123

The particular modules are independently of each other. Therefore I think it is correct to set the dependency of this apt source separately in each module.

A workaround would be to rename one source from puppetlabs to puppetlabs2 or sth. like that. But there must be another solution.

I am curious about your responses!

share|improve this question
up vote 4 down vote accepted

Whenever I have this problem (particularly common with packages), I just put the resource in a class, all by itself:

class git {
    package { 'git': ensure => installed, }

Then I include the class instead of defining the resource.

Next problem: but they are used by different modules! Yes, either put them in common, or in some other module-specific common module (say, puppet-common).

share|improve this answer

There are several ways to address this. I'd personally split your apt source into a separate class and then use an include or inheritance (depending on situation) to pull this class into where ever you need it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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