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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.