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 https://github.com/puppetlabs/puppet-apt). So I have the following defined resource in puppet and puppet-dashboard-module:
apt::source { "puppetlabs": location => "http://apt.puppetlabs.com", release => "squeeze", repos => "main", required_packages => true, include_src => false, key => "4BD6EC30", key_server => "pgp.mit.edu", }
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!