El dc 04 de 11 de 2009 a les 12:06 +0100, en/na Brice Figureau va
escriure:
> On Wed, 2009-11-04 at 11:51 +0100, lluis wrote:
> > El dc 04 de 11 de 2009 a les 11:21 +0100, en/na Peter Meier va escriure:
> > > Hi
> > > 
> > > > I have several modules that need to export the same sshkey resources
> > > > with different tags each one, for example:
> > > > 
> > > > # module backups
> > > > @@sshkey { $fqdn:
> > > >     key => $sshrsakey,
> > > >     type => "rsa",
> > > >     tag => "backups_$fqdn",
> > > > }
> > > > 
> > > > # module ssh
> > > > @@sshkey { $fqdn:
> > > >     key => $sshrsakey,
> > > >     type => "rsa",
> > > >     tag => "ssh_$fqdn",
> > > > }
> > > > 
> > > > this throws a duplicate definition error like:
> > > > 
> > > > err: Could not retrieve catalog from remote server: Error 400 on SERVER:
> > > > Duplicate definition: Sshkey[vbox1.ingent.ct] is already defined in
> > > > file 
> > > > /home/lluis/git/initr/puppet/modules/ssh_station/manifests/server.pp at 
> > > > line 36; cannot redefine at 
> > > > /home/lluis/git/initr/puppet/modules/webserver1/manifests/init.pp:200 
> > > > on node vbox1.ingent.ct
> > > 
> > > actually what are you doing is managing the same resource twice, hence
> > > the duplicate definition error. For puppet the variable labeled as
> > > `namevar` in the Reference has to be unique per resource for one host.
> > > 
> > > > sshkey name or alias must be $fqdn to make ssh associate correct
> > > > ssh_known_hosts line with the node, how can I export the same sshkey
> > > > with different tags in separate modules?
> > > 
> > > 
> > > you can add multiple tags to one resource:
> > > 
> > > 
> > > @@sshkey { $fqdn:
> > >     key => $sshrsakey,
> > >     type => "rsa",
> > >     tag => [ "backups_$fqdn", "ssh_$fqdn" ],
> > > }
> > > 
> > > cheers pete
> > 
> > there's any way to do this on different modules?
> 
> Have this in a separate class that would be included in both module.
> You can even do:
> 
> class mysshkey {
>       @@sshkey {
>               "$fqdn":
>               key => $sshraskey, type => rsa;
>       }
> }
> 
> in backups:
> 
> class backups::sshkey inherits mysshkey {
>       Sshkey[$fqdn] { tag +> "backups_$fqdn" }
> }
> 
> class backups {
>       include backups::sshkey
>       ...
> }
> 
> in ssh:
> 
> class ssh::sshkey inherits mysshkey {
>       Sshkey[$fqdn] { tag +> "ssh_$fqdn" }
> }
> 
> class ssh {
>       include ssh::sshkey
>       ...
> }
> 
> Or a variation of this...

thanks! this is exactly what I was looking for, but I can't make it
work; including both ssh and backups classes throws this error:


err: Could not retrieve catalog from remote server: Error 400 on SERVER:
Parameter 'tag' is already set on Sshkey[vbox1.ingent.ct] by
ssh_station::server::sshkey
at /home/lluis/git/initr/puppet/modules/ssh_station/manifests/server.pp:43; 
cannot redefine at 
/home/lluis/git/initr/puppet/modules/webserver1/manifests/init.pp:205 on node 
vbox1.ingent.ct

instead of exporting sshkey with the two tags


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to