Justin Williams wrote: > That is perfect! Thank you! > > So, if I have: > Class A for basic stuff > Class B for system specific stuff > and Class C for other stuff that has to happen after classes A & B, > then, if I have, say, file { "/foo/bar/snarfblatt": require => Class[" > B"], etc; } in class C > And then require File["/foo/bar/snarfblatt"] in the rest of the > resouces in class C > > Then that will definitively set the order of B must happen before the > file can be copied over, and the file must be copied over before > anything else can be done in class C. > > Of course, that means I have to copy in umpteen bajillion "require > File..." statements, to get everything else in order in Class C, but, > doing that once versus continually having to go back and play clean up > while rolling out a new box, it's a whole lot mote time effective! > You can also setup class to class or class to resource relationships but it is hackish. If you set a variable inside a class with the same name as a metaparameter, the metaparameter is applied to the class. For example: class bar { $require = File['foo'] } You can could also set default attributes for a given resource type within a class or specify a list of files in an array to reduce the amount of repeated code you have in a class. > Thanks again!! > > On Thu, Oct 16, 2008 at 10:47 AM, Teyo Tyree <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > Hey Zoniguana, > > zoniguana wrote: >> I'm probably being dense here, but.... >> >> Is if possible to include a class, onlyif a given file exists? >> If not, can I put an onlyif in all the file/cron/service/etc >> statements, so that they are only executed once that file is put in >> place (I.e. only run phase 2 of the configging once a file is in place >> to confirm that ALL of phase 1 is done)? >> >> > You probably want to use the 'require' or 'before' metaparameters > here. These Metaparameters establish ordering relationships > between classes and resources i.e.: > > file {"foo": > path => "/etc/foo", > content => "the sets up the bar service" > } > service {"bar": > ensure => running, > enabled = true, > require => File["foo"] > } > > This sets up a relationship between the File["foo"] resource and > the Service["bar"] resource such that the File['foo'] must exist > before the Service["bar"] is started. The same holds true for > class relationships i.e.: > > class foo { > file {"foo": > path => "/etc/foo", > content => "the sets up the bar service" > } > user {"foo": > ensure => present > } > } > > service{"bar": > ensure => running, > enabled = true, > require => Class["foo"] > } > > In this case, all the conditions of resources defined in > Class["foo"] must be satisfied before Service["bar"] is started. > The before metaparameter just sets up the reverse relationship > between classes and resources. > >> A little confused on trying to find a way to order classes, if I can >> manage it.... >> i.e. make all the basic stuff happen, then make some other stuff >> happen, then make the most advanced stuff (that relies on everything >> else being done first) happen. >> >> > -teyo > > -- > > Those who claim the dead never return to life haven't ever been around > here at quitting time. > > Teyo Tyree ::: http://reductivelabs.com ::: +1.615.275.5066 > > > > > > > >
-- --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---