Hello, I''m new to Puppet, and I''m having some trouble getting run stages to work with one of my modules. The module is quite complicated and involves several operations where order is very important. In short, here are the steps 1) Install some packages 2) Create a user and home dir 3) Install Mysql-server* 4) Set mysql root pw* 5) Create databases* 6) Create db users* 7) setup grants for db users** 8) Setup firewall*** 9) Create cron jobs * Used puppetlabs-mysql ** Used puppetlabs-mysql and exec (for column-specific perms) *** Used puppetlabs-firewall I originally setup this module to use chaining, but it was tremendously complicated (one huge line). I decided to give run stages a try, and it seems to work, but I think that I''m doing it wrong and need some help. Here''s the init.pp for the module described above, billing. class billing { include billing::install, billing::service, billing::config::main, billing::config::dbserver, billing::config::dbs, billing::config::dbinit, billing::config::dbusers, billing::config::dbgrants, billing::config::cron, billing::firewall, billing::firewall::sys, billing::firewall::app, billing::firewall::denial } class { "billing::install": stage => install; "billing::config::main": stage => main; "billing::config::dbserver": stage => dbserver; "billing::config::dbs": stage => dbs; "billing::config::dbinit": stage => dbinit; "billing::config::dbusers": stage => dbusers; "billing::config::dbgrants": stage => dbgrants; "billing::config::cron": stage => cron; "billing::firewall": stage => fwmain; "billing::firewall::sys": stage => fwsys; "billing::firewall::app": stage => fwapp; "billing::firewall::denial": stage => fwdenial; "billing::service": stage => service; } stage { install: before => Stage[main] } stage { main: before => Stage[dbserver] } stage { dbserver: before => Stage[dbs] } stage { dbs: before => Stage[dbinit] } stage { dbusers: before => Stage[dbgrants] } stage { dbgrants: before => Stage[cron] } stage { cron: before => Stage[fwmain] } stage { fwmain: before => Stage[fwsys] } stage { fwsys: before => Stage[fwapp] } stage { fwapp: before => Stage[fwdenial] } stage { fwdenial: before => Stage[service] } stage { service: after => Stage[fwdenial] } Hopefully that gives a good idea of what is happening. The code for all those classes is too much to post here. This module is only used on a single node. However, other nodes (that don''t "include billing") get an error: *Could not find stage install specified by Class[Billing::Install] at /etc/puppet/modules/billing/manifests/init.pp:19* I''m guessing that is because the class and stage definitions happen outside "class billing { ... }." But, it was a syntax error to put them inside. What''s the recommendation here? Use chains? How do you all deal with modules that have lots of ordered steps? Thanks, Justin -- 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/-/oweGBJ8rbMYJ. 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.
Alessandro Franceschi
2012-Sep-17 14:31 UTC
[Puppet Users] Re: Run Stages for Particular Modules
It feels like you''re overusing a bit too much run stages... Read here for usage recommendations (and limitations): http://docs.puppetlabs.com/puppet/2.7/reference/lang_run_stages.html You can more easily manage relationships inside a class (all the mysql steps can be managed inside the same mysql module) and maybe attributes like require or before can result easier to manage than chains, in this case. my2c al On Friday, September 14, 2012 4:31:25 PM UTC+2, jbrown wrote:> > Hello, > > I''m new to Puppet, and I''m having some trouble getting run stages to work > with one of my modules. The module is quite complicated and involves > several operations where order is very important. > In short, here are the steps > 1) Install some packages > 2) Create a user and home dir > 3) Install Mysql-server* > 4) Set mysql root pw* > 5) Create databases* > 6) Create db users* > 7) setup grants for db users** > 8) Setup firewall*** > 9) Create cron jobs > > * Used puppetlabs-mysql > ** Used puppetlabs-mysql and exec (for column-specific perms) > *** Used puppetlabs-firewall > > I originally setup this module to use chaining, but it was tremendously > complicated (one huge line). I decided to give run stages a try, and it > seems to work, but I think that I''m doing it wrong and need some help. > > Here''s the init.pp for the module described above, billing. > > class billing { > include billing::install, billing::service, billing::config::main, > billing::config::dbserver, billing::config::dbs, billing::config::dbinit, > billing::config::dbusers, billing::config::dbgrants, billing::config::cron, > billing::firewall, billing::firewall::sys, billing::firewall::app, > billing::firewall::denial > } > > class { > "billing::install": stage => install; > "billing::config::main": stage => main; > "billing::config::dbserver": stage => dbserver; > "billing::config::dbs": stage => dbs; > "billing::config::dbinit": stage => dbinit; > "billing::config::dbusers": stage => dbusers; > "billing::config::dbgrants": stage => dbgrants; > "billing::config::cron": stage => cron; > "billing::firewall": stage => fwmain; > "billing::firewall::sys": stage => fwsys; > "billing::firewall::app": stage => fwapp; > "billing::firewall::denial": stage => fwdenial; > "billing::service": stage => service; > } > > stage { install: before => Stage[main] } > stage { main: before => Stage[dbserver] } > stage { dbserver: before => Stage[dbs] } > stage { dbs: before => Stage[dbinit] } > stage { dbusers: before => Stage[dbgrants] } > stage { dbgrants: before => Stage[cron] } > stage { cron: before => Stage[fwmain] } > stage { fwmain: before => Stage[fwsys] } > stage { fwsys: before => Stage[fwapp] } > stage { fwapp: before => Stage[fwdenial] } > stage { fwdenial: before => Stage[service] } > > stage { service: after => Stage[fwdenial] } > > Hopefully that gives a good idea of what is happening. The code for all > those classes is too much to post here. > > This module is only used on a single node. However, other nodes (that > don''t "include billing") get an error: > > *Could not find stage install specified by Class[Billing::Install] at > /etc/puppet/modules/billing/manifests/init.pp:19* > > I''m guessing that is because the class and stage definitions happen > outside "class billing { ... }." But, it was a syntax error to put them > inside. > > What''s the recommendation here? Use chains? How do you all deal with > modules that have lots of ordered steps? > > Thanks, > > Justin >-- 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/-/dX9Q0s_MlZ4J. 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 Monday, September 17, 2012 9:31:41 AM UTC-5, Alessandro Franceschi wrote:> > It feels like you''re overusing a bit too much run stages...That''s putting it mildly.> Read here for usage recommendations (and limitations): > http://docs.puppetlabs.com/puppet/2.7/reference/lang_run_stages.html > You can more easily manage relationships inside a class (all the mysql > steps can be managed inside the same mysql module) and maybe attributes > like require or before can result easier to manage than chains, in this > case. > >+1 Indeed, there is nothing you can do with stages that you cannot also accomplish with ordinary resource relationships. Stages basically allow you to define a lot of relationships in a simple, compact way, but for ordering small numbers or resources that all know about each other they cost a lot more than ordinary relationships. John -- 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/-/_mUruEmIk6sJ. 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 I just tried reading the .dot files today into a graphing application and I found that very useful in visualising the graph of resources that is produced by a run on the agent. Good luck. It''s not procedural, but declarative, hence a visual graph let''s a person picture it better IMHO. http://bitfieldconsulting.com/puppet-dependency-graphs cheers, Jason -- 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/-/COG6RdyscvAJ. 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.
Justin Brown
2012-Sep-18 01:45 UTC
Re: [Puppet Users] Re: Run Stages for Particular Modules
Thanks for the replies John and Al. I''ve spent some time re-designing my module. It''s now a few separate modules that use smaller chains and is far more readable. Cheers, Justin On Mon, Sep 17, 2012 at 10:28 AM, jcbollinger <John.Bollinger@stjude.org>wrote:> > > On Monday, September 17, 2012 9:31:41 AM UTC-5, Alessandro Franceschi > wrote: >> >> It feels like you''re overusing a bit too much run stages... > > > That''s putting it mildly. > > >> Read here for usage recommendations (and limitations): >> http://docs.puppetlabs.com/**puppet/2.7/reference/lang_run_**stages.html<http://docs.puppetlabs.com/puppet/2.7/reference/lang_run_stages.html> >> You can more easily manage relationships inside a class (all the mysql >> steps can be managed inside the same mysql module) and maybe attributes >> like require or before can result easier to manage than chains, in this >> case. >> >> > +1 > > Indeed, there is nothing you can do with stages that you cannot also > accomplish with ordinary resource relationships. Stages basically allow > you to define a lot of relationships in a simple, compact way, but for > ordering small numbers or resources that all know about each other they > cost a lot more than ordinary relationships. > > > John > > -- > 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/-/_mUruEmIk6sJ. > > 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. >-- 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.