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"]
}



> 
> 
> Thanks & greetings!
> Axel.
> 
> 
> -- 
> 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/-/zUkjN-osHugJ.
> 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.

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to