On Thursday, August 23, 2012 12:59:32 AM UTC-5, Douglas wrote: > > On Wed, Aug 22, 2012 at 6:06 AM, Martin Alfke <tux...@gmail.com<javascript:>> > wrote: > > > > On 22.08.2012, at 14:27, Axel Bock wrote: > > > > Hi readers > > > > another question for my little puppet project: Can I (and if yes, how) > > define dependendies between puppet "defines"? (define like in define > > mymodule::mydefine() {...}) > > > > Example: I have a define "prepare_cool_thing" and another define > > "cool_thing". Both can be on a machine several times (quite, actually, > like > > vhosts :). So this is entirely valid: > > > > prepare_cool_thing{ "name1" : } > > cool_thing{ "name1" : } > > > > prepare_cool_thing{ "name2" : } > > cool_thing{ "name2" : } > > > > I'm sure you get it. BUT. I'd like to state within the cool_thing define > > that the prepare_cool_thing was executed. Can I do that? The following > does > > not seem to do what I want: > > > > Prepare_cool_thing[ "name1" ] -> Cool_thing[ "name1" ] # naah, does not > > work. > > > > > > Where did you put the dependency? > > What puppet version are you using. > > > > Normally this works: > > > > define task_one ( $user = 'root' ) { > > file { '/tmp/one': > > owner => $user, > > content => $user, > > } > > } > > define task_two ( $user = 'root' ) { > > file { '/tmp/two': > > owner => $user, > > content => $user, > > } > > } > > task_one { 'foo': } > > task_two { 'foo': } > > Task_one['foo'] -> Task_two['foo'] > > > > You can also place the order inside the define: > > > > define task_two ( $user = 'root') { > > file { '/tmp/two': > > owner => $name, > > content => $name, > > } > > Task_one["$name"] -> Task_two["$name"] > > } > > This really irks me. Is this documented anywhere? How did Task_one get > into scope inside Task_two? What is the scope for definitions? Are > they global? >
All declared resource instances and classes have global scope. That includes resource instances of defined and custom types. 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/-/dn3d1FxLmioJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.