trey85stang
2012-Jun-20 22:20 UTC
[Puppet Users] Problem dealing with multi role servers/manifests. resource already declared.
Hey All, Im running into a road block with a server that is going to to be multi role. Example: I want to run a nagios server and a repo server on one box. My nagios manifest has two services defined: class nagios::server { ... service { nagios: ensure => running, ... } service { httpd: ensure => running ... } ... } Now I also want to assign my reposerver manifest to a server already running the nagios manifest class repo::server { ... service { httpd: ensure => running } ... } Now in each case I have files where httpd is notified to refresh... Is there a way to work around this without creating a custom module just for this one case? As you can see from the below error message I tried changing the name and using an alias.. but it does not like that either. There error message: Could not retrieve catalog from remote server: Error 400 on SERVER: Puppet::Parser::AST::Resource failed with error ArgumentError: Cannot alias Service[reposerver-httpd] to ["httpd"] at /etc/puppet/ environments/dev/modules/repo/manifests/init.pp:113; resource ["Service", "httpd"] already declared at /etc/puppet/environments/dev/ modules/nagios/manifests/init.pp:217 at /etc/puppet/environments/dev/ modules/opservers/manifests/init.pp:113 on node mynode.com -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Walter Heck
2012-Jun-21 06:10 UTC
Re: [Puppet Users] Problem dealing with multi role servers/manifests. resource already declared.
On Thu, Jun 21, 2012 at 6:20 AM, trey85stang <trey85stang@gmail.com> wrote:> Now in each case I have files where httpd is notified to refresh... > Is there a way to work around this without creating a custom module > just for this one case? As you can see from the below error message I > tried changing the name and using an alias.. but it does not like that > either.The combination of Resource type and title needs to be unique for a single node. However, you can also not have two resources managing the same thing (in this case the http service). In order to get around this properly, you''d need to extract httpd into a module of it''s own (where it belongs imho anyway) and refer to the service from both your nagios and your repoman manifests. If you don''t want to make that module a full fledged apache (or whichever webserver you are running), then that''s okay. Just keep it very simple, but do extract it. You can always expand it later. kind regards, -- Walter Heck -- Check out my startup: Puppet training and consulting @ http://www.olindata.com Follow @olindata on Twitter and/or ''Like'' our Facebook page at http://www.facebook.com/olindata -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
trey85stang
2012-Jun-21 14:01 UTC
Re: [Puppet Users] Problem dealing with multi role servers/manifests. resource already declared.
Sounds good, not the way I was hoping to have to do it.. but that will work. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/Ld0sFBSIFnwJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
trey85stang
2012-Jun-21 14:24 UTC
Re: [Puppet Users] Problem dealing with multi role servers/manifests. resource already declared.
Actually, one more question to spawn off this... Is there a way in my nagios/repo class to say if you have this class go ahead and assign yourself to my new services:httpd class? Can that be done with inheritance? I have never used inheritance so I am not sure. On Thursday, June 21, 2012 9:01:24 AM UTC-5, trey85stang wrote:> > Sounds good, not the way I was hoping to have to do it.. but that will > work. >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/8-pcqQeLB4sJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
trey85stang
2012-Jun-21 14:32 UTC
Re: [Puppet Users] Problem dealing with multi role servers/manifests. resource already declared.
Hell... I just tried it an it works fine. At least that way I dont have to go back and assign all my servers to the new httpd module. On Thursday, June 21, 2012 9:24:59 AM UTC-5, trey85stang wrote:> > Actually, one more question to spawn off this... Is there a way in my > nagios/repo class to say if you have this class go ahead and assign > yourself to my new services:httpd class? Can that be done with > inheritance? I have never used inheritance so I am not sure. > > On Thursday, June 21, 2012 9:01:24 AM UTC-5, trey85stang wrote: >> >> Sounds good, not the way I was hoping to have to do it.. but that will >> work. >> >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/7lZdoiszFWUJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Nick Fagerlund
2012-Jun-21 22:19 UTC
Re: [Puppet Users] Problem dealing with multi role servers/manifests. resource already declared.
On Thursday, June 21, 2012 7:24:59 AM UTC-7, trey85stang wrote:> > Actually, one more question to spawn off this... Is there a way in my > nagios/repo class to say if you have this class go ahead and assign > yourself to my new services:httpd class? Can that be done with > inheritance? I have never used inheritance so I am not sure. > >You shouldn''t need inheritance -- you can do this with plain old "include services::httpd". Unlike when you declare a resource, include can be safely used multiple times on a single class, pretty much for this exact reason. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/uZe07BASzP4J. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
trey85stang
2012-Jun-22 14:48 UTC
Re: [Puppet Users] Problem dealing with multi role servers/manifests. resource already declared.
On Thursday, June 21, 2012 5:19:32 PM UTC-5, Nick Fagerlund wrote:> > > > On Thursday, June 21, 2012 7:24:59 AM UTC-7, trey85stang wrote: >> >> Actually, one more question to spawn off this... Is there a way in my >> nagios/repo class to say if you have this class go ahead and assign >> yourself to my new services:httpd class? Can that be done with >> inheritance? I have never used inheritance so I am not sure. >> >> > You shouldn''t need inheritance -- you can do this with plain old "include > services::httpd". Unlike when you declare a resource, include can be safely > used multiple times on a single class, pretty much for this exact reason. >Ok, even better! Thank you! -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/bJGE13g-jCMJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.