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.
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+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
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+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.
Hm, my last answer didn''t get posted. So let''s go again.
First, thanks for your help, it seems to work now - maybe I fixed another
bug or did something wrong. But now I have another at which I''m stuck.
Basically I configure our web servers with puppet. For that I have a
"webserver" class which basically sets up only the environment for web
service, and a preparevhost define which, well, prepares a vhost on the
machine.
What puppet does now is to execute some of the preparevhost definitions
_before_ the webserver class is applied, which fails miserably. EVEN though
I defined a require => to a directory managed by the ws class from within
the define - puppet simply seems to ignore that.
So how can I make sure that the webserver class gets applied fully before
the prepvhost define is started? The node configuration looks like this now:
node ''server'' { include webserver }
node ''host1'' inherits ''server'' {
preparevhost {"url" : } }
I''d appreciate any help :) . Oh, and yes, my puppet version is 2.6.12
from
SLES 11 SP2.
Thanks in advance & greetings!
Axel.
Am Mittwoch, 22. August 2012 14:27:03 UTC+2 schrieb Axel
Bock:>
> 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.
>
>
> 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/-/3Y9pO2Vb4dYJ.
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 Wed, Aug 22, 2012 at 6:06 AM, Martin Alfke <tuxmea@gmail.com> 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? Doug. -- 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.
On 23.08.2012, at 07:59, Douglas Garstang wrote: ...>> 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?My testcase run in a single manifest. So all defines are within the same scope. In case that you use modules you need to give the full scope on ordering. e.g. Modue_one::Task_one[''foo''] -> Module_two::Task_two[''foo''] -- 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.
Ah maybe I''m too stupid but the whole puppet dependency resolution
_seriously_ annoys me, so this is half a rant post, half a plea for someone
to enlighten me about this dependency thing puppet has going.
I have another custom define which basically contains an exe and a file
(directory). The file is not dependent on anything, but everywhere I use it
I add a "require" to the define roughly like this:
my_rsync_define { ... require => something_else_before }.
unfortunately puppet simply does not care and tries do create the directory
as the first step in the process, failing. this is not intuitive _at all_.
the dot graph (I used graphviz a lot today) tells me that the DEFINE itself
actually IS dependant on the something_else_before I added, but the
DIRECTORY WITHIN THE DEFINE ... stands alone. I personally think this is
... not great. but maybe it''s because I have an old version. File
autorequires don''t seem to work too well here, too, I think.
Am Mittwoch, 22. August 2012 14:27:03 UTC+2 schrieb Axel
Bock:>
> 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.
>
>
> 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/-/9BNRHcD0VSoJ.
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 23.08.2012, at 14:25, Axel Bock wrote:> Ah maybe I''m too stupid but the whole puppet dependency resolution _seriously_ annoys me, so this is half a rant post, half a plea for someone to enlighten me about this dependency thing puppet has going. > > I have another custom define which basically contains an exe and a file (directory). The file is not dependent on anything, but everywhere I use it I add a "require" to the define roughly like this: > my_rsync_define { ... require => something_else_before }. > > unfortunately puppet simply does not care and tries do create the directory as the first step in the process, failing. this is not intuitive _at all_. the dot graph (I used graphviz a lot today) tells me that the DEFINE itself actually IS dependant on the something_else_before I added, but the DIRECTORY WITHIN THE DEFINE ... stands alone. I personally think this is ... not great. but maybe it''s because I have an old version. File autorequires don''t seem to work too well here, too, I think.From my experience: best is to add ordering to all resources. - inside a define - inside a class - between classes> > > > > > > Am Mittwoch, 22. August 2012 14:27:03 UTC+2 schrieb Axel Bock: > 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. > > > 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/-/9BNRHcD0VSoJ. > 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.
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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.