hello guys, I am trying to incorporate run stages into my puppet setup. I''ve been working with this for a few days and I haven''t quite got the hang of it yet... When I attempt my puppet run this is the error I see: ------------------------------------------------ [root@chromews21 ~]# puppetd -t err: Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate definition: Class[Centos] is already defined; cannot redefine at /etc/puppet/manifests/nodes.pp:28 on node chromews21.example.net warning: Not using cache on failed catalog err: Could not retrieve catalog; skipping run Which is confusing because I was under the impression that under 2.6 the class / stage relationship basically takes the place of ''include foo'' where foo is a class you want to use. ------------------------------------------ Just to step you through my logic, I define my stages in site.pp (so that they will be applied everywhere): import "template" import "nodes" import "classes/*" import "groups/*" import "users/*" import "os/*" # site.pp file { "/etc/sudoers": owner => root, group => root, mode => 440 } filebucket { main: server => puppet } File { backup => main } stage {"os": before => Stage["main"]} stage {"repos": before => Stage["main"]} stage {"last": require => Stage["main"]} ------------------------------------------------------ This is the relationship I setup in template.pp -------------------------------------------------------- node basenode { case $operatingsystem { centos: { include centos } ubuntu: { include ubuntu } default: { include centos } } include baseapps, sshd } node default inherits basenode {} node webserver inherits basenode { ## <-- I used to define ''include apache'' here } node dbserver inherits basenode { include mysql } node mailserver inherits basenode { include postfix } ----------------------------------------------------------------- And then this is how I define my client that I am working with: ----------------------------------------------------------------- node ''chromews21.acadaca.net'' inherits webserver { ## <-- instead what I attempt to do is setup the stage relationships here class {"centos": stage => os} class {"yumrepos": stage => repos} class {"baseapps": stage => main} class {"basefiles": stage => main} class {"apache": stage => last} } ------------------------------------------------------------------------------------------- So obviously I am not trying to redefine the centos class. I am merely trying to setup a precedence in terms of how the software is installed. Thanks in advance for your help! -- GPG me!! gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B -- 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.
On Fri, Mar 25, 2011 at 9:36 AM, Tim Dunphy <bluethundr@gmail.com> wrote:> hello guys, > > I am trying to incorporate run stages into my puppet setup. I''ve been > working with this for a few days and I haven''t quite got the hang of > it yet... > > > When I attempt my puppet run this is the error I see: > > ------------------------------------------------ > > [root@chromews21 ~]# puppetd -t > err: Could not retrieve catalog from remote server: Error 400 on > SERVER: Duplicate definition: Class[Centos] is already defined; cannot > redefine at /etc/puppet/manifests/nodes.pp:28 on node > chromews21.example.net > warning: Not using cache on failed catalog > err: Could not retrieve catalog; skipping run > > > > Which is confusing because I was under the impression that under 2.6 > the class / stage relationship basically takes the place of ''include > foo'' where foo is a class you want to use. > > ------------------------------------------ > > Just to step you through my logic, I define my stages in site.pp (so > that they will be applied everywhere): > > import "template" > import "nodes" > import "classes/*" > import "groups/*" > import "users/*" > import "os/*" > > # site.pp > file { "/etc/sudoers": > owner => root, group => root, mode => 440 > } > > filebucket { main: server => puppet } > File { backup => main } > > stage {"os": before => Stage["main"]} > stage {"repos": before => Stage["main"]} > stage {"last": require => Stage["main"]} > > > ------------------------------------------------------ > > This is the relationship I setup in template.pp > > > -------------------------------------------------------- > > node basenode { > > case $operatingsystem { > centos: { include centos } > ubuntu: { include ubuntu } > default: { include centos } > } > include baseapps, sshd > > } > > node default inherits basenode {} > > node webserver inherits basenode { > ## <-- I used to define ''include apache'' here > } > > node dbserver inherits basenode { > include mysql > } > > node mailserver inherits basenode { > include postfix > } > > > ----------------------------------------------------------------- > > And then this is how I define my client that I am working with: > > > ----------------------------------------------------------------- > > > node ''chromews21.acadaca.net'' inherits webserver { ## <-- instead > what I attempt to do is setup the stage relationships here > class {"centos": stage => os} > class {"yumrepos": stage => repos} > class {"baseapps": stage => main} > class {"basefiles": stage => main} > class {"apache": stage => last} > } >class is not a resource, you can not inherit and override the stage attribute after you declared include centos. You need to define the stage on declaration. so specify class {"centos": stage => ''os''} in basenode, or do not inherit webserver for the test node. Thanks, Nan -- 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.
Hi Tim, I wrote an article on RunStages here about a week or so ago --> http://glarizza.posterous.com/using-run-stages-with-puppet Maybe it will help you out a bit with the syntax itself, and then you can build from there? I hope it helps! On Thu, Mar 24, 2011 at 6:36 PM, Tim Dunphy <bluethundr@gmail.com> wrote:> hello guys, > > I am trying to incorporate run stages into my puppet setup. I''ve been > working with this for a few days and I haven''t quite got the hang of > it yet... > > > When I attempt my puppet run this is the error I see: > > ------------------------------------------------ > > [root@chromews21 ~]# puppetd -t > err: Could not retrieve catalog from remote server: Error 400 on > SERVER: Duplicate definition: Class[Centos] is already defined; cannot > redefine at /etc/puppet/manifests/nodes.pp:28 on node > chromews21.example.net > warning: Not using cache on failed catalog > err: Could not retrieve catalog; skipping run > > > > Which is confusing because I was under the impression that under 2.6 > the class / stage relationship basically takes the place of ''include > foo'' where foo is a class you want to use. > > ------------------------------------------ > > Just to step you through my logic, I define my stages in site.pp (so > that they will be applied everywhere): > > import "template" > import "nodes" > import "classes/*" > import "groups/*" > import "users/*" > import "os/*" > > # site.pp > file { "/etc/sudoers": > owner => root, group => root, mode => 440 > } > > filebucket { main: server => puppet } > File { backup => main } > > stage {"os": before => Stage["main"]} > stage {"repos": before => Stage["main"]} > stage {"last": require => Stage["main"]} > > > ------------------------------------------------------ > > This is the relationship I setup in template.pp > > > -------------------------------------------------------- > > node basenode { > > case $operatingsystem { > centos: { include centos } > ubuntu: { include ubuntu } > default: { include centos } > } > include baseapps, sshd > > } > > node default inherits basenode {} > > node webserver inherits basenode { > ## <-- I used to define ''include apache'' here > } > > node dbserver inherits basenode { > include mysql > } > > node mailserver inherits basenode { > include postfix > } > > > ----------------------------------------------------------------- > > And then this is how I define my client that I am working with: > > > ----------------------------------------------------------------- > > > node ''chromews21.acadaca.net'' inherits webserver { ## <-- instead > what I attempt to do is setup the stage relationships here > class {"centos": stage => os} > class {"yumrepos": stage => repos} > class {"baseapps": stage => main} > class {"basefiles": stage => main} > class {"apache": stage => last} > } > > > > > ------------------------------------------------------------------------------------------- > > > > So obviously I am not trying to redefine the centos class. I am merely > trying to setup a precedence in terms of how the software is > installed. > > > Thanks in advance for your help! > > -- > GPG me!! > > gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B > > -- > 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. > >-- Gary Larizza Director of Technology Huron City Schools http://www.huronhs.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.
On Mar 24, 5:36 pm, Tim Dunphy <bluethu...@gmail.com> wrote:> Which is confusing because I was under the impression that under 2.6 > the class / stage relationship basically takes the place of ''include > foo'' where foo is a class you want to use.That is a somewhat mistaken impression, but I can see how you might get it. Puppet 2.6 introduces parameterized classes, and with them, an alternative syntax for including classes and declaring their parameters ( class { <name>: [parameters] } ). Puppet leverages that syntax for assigning classes to run stages, by automatically giving all classes a "stage" metaparameter. It is therefore true that assigning a class to a run stage does include that class, but (and this is your mistake) doing so is not semantically equivalent to "include foo", because the parameterized class inclusion mechanism is not a strict replacement for the "include" statement. In particular, a significant limitation of parameterized classes is that you can only include each one once for each node. Your node ''chromews21.acadaca.net'' includes class "centos" twice, once inherited from basenode, and once explicitly itself. That would be OK if you used the "include" statement to perform both inclusions, but it is *not* ok if you use the parameterized class syntax, regardless of which parameters you set and which values you assign to them. As far as I know, however, you cannot assign a run stage without using the parameterized class syntax. Nan already described the possible solutions. I''m just trying to give you a better understanding of the problem. Cheers, John -- 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.
Hello again list! I apologize for having to come back to this well for your wisdom. However I have been struggling to implement run stages in puppet 2.6 for quite some time now with absolutely no luck. I did attempt to follow Gary L''s very nice blog on the topic but unfortunately I seem to be missing out on something very basic here. I did also follow Nan''s advice here:>class is not a resource, you can not inherit and override the stage >attribute after you declared include centos. You need to define the >stage on declaration. so specify class {"centos": stage => ''os''} in >basenode, or do not inherit webserver for the test node.And in an attempt to get a _very_basic_ form of run stages functioning I have scaled back my efforts considerably. I have removed the logical branch which determines whether the client is a centos or an ubuntu machine and am attempting to **ONLY** install a class called centos::yumrepos. That''s it. Just install the centos::yumrepos class. :) Here''s what I''ve come up with so far: # site.pp import "template" import "nodes" import "classes/*" import "groups/*" import "users/*" import "os/*" file { "/etc/sudoers": owner => root, group => root, mode => 440 } filebucket { main: server => puppet } File { backup => main } Exec { path => "/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/home/ec2/bin:/home/ec2/bin:/home/ec2/bin:/root/bin" } stage { "repo": before => Stage["main"] } ## /etc/puppet/manifests/template.pp node basenode { include sshd class { "centos::yumrepos": stage => repo } } node webserver inherits basenode { } ## /etc/puppet/manifests/nodes.pp node ''puppet.example.com'' inherits webserver { } This seems like it would be a pretty straight forward process to me. However all that does in this case is turn everything in the whole shebang into a dependency. It''s very disheartening! notice: /Stage[main]//Group[daemon]: Dependency Yumrepo[webtatic] has failures: true notice: /Stage[main]//Group[daemon]: Dependency Yumrepo[webtatic-debuginfo] has failures: true notice: /Stage[main]//Group[daemon]: Dependency Yumrepo[webtatic-source] has failures: true notice: /Stage[main]//Group[daemon]: Dependency Yumrepo[updates] has failures: true notice: /Stage[main]/Sshd/Package[openssh]: Dependency Yumrepo[webtatic] has failures: true notice: /Stage[main]/Sshd/Package[openssh]: Dependency Yumrepo[webtatic-debuginfo] has failures: true notice: /Stage[main]/Sshd/Package[openssh]: Dependency Yumrepo[webtatic-source] has failures: true notice: /Stage[main]/Sshd/Package[openssh]: Dependency Yumrepo[updates] has failures: true notice: /Stage[main]/Sshd/Package[openssh]: Dependency Yumrepo[scalr] has failures: true notice: /Stage[main]//Group[wheel]: Dependency Yumrepo[webtatic] has failures: true notice: /Stage[main]//Group[wheel]: Dependency Yumrepo[webtatic-debuginfo] has failures: true notice: /Stage[main]//Group[wheel]: Dependency Yumrepo[webtatic-source] has failures: true notice: /Stage[main]//Group[wheel]: Dependency Yumrepo[updates] has failures: true and etc.. I''ve enclosed some more complete error output for context. I really feel that I am close to solving this problem and would certainly appreciate any tips you might have to offer. best regards! tim -- 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.
On Tue, Apr 12, 2011 at 06:57:42PM -0400, Tim Dunphy wrote:> Here''s what I''ve come up with so far: > > stage { > "repo": before => Stage["main"] > }Have you tried using the other syntax: stage{ [repo]: } Stage[repo] -> Stage[main] in site.pp? -- Ben Hughes || http://www.puppetlabs.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.
On Apr 12, 5:57 pm, Tim Dunphy <bluethu...@gmail.com> wrote:> This seems like it would be a pretty straight forward process to me. > However all that does in this case is turn everything in the whole > shebang into a dependency. It''s very disheartening!Well, that''s basically how run stages work. A Stage is just a resource whose sole purpose is to provide for ordering of other resources, via the ordinary resource dependency mechanism. What did you hope would happen that didn''t? John -- 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.