Hi Felix,

Thanks for the help. I have solved it another way.

In my case the array is dynamic. My scripts should support any number
of IPs. Initially we dont know that. The user will set the array in
the site.pp and run the scripts. Our modules should rnu according to
the length of the array. So here

proxy_ring {
        "1": $ip1;
        "2": $ip2;
        ...

}

We cannot hardcode the parameters.

However, I have solved that in different manner.

I have used the John's comment "Exec<| tag == 'test_tag' |> -> File['/
tmp/testecho.txt'] " statement to tell the dependency to the Ruby DSL.

Thanks everybody who helped me.

Thanks,
Sateesh B.

On Feb 9, 1:39 pm, Felix Frank <felix.fr...@alumni.tu-berlin.de>
wrote:
> On 02/09/2012 05:50 AM, Eric Shamow wrote:
>
> > Sateesh,
>
> > It is better if you don't look at it as a "loop."  A loop is a very
> > procedural concept.  You are working with a machine that you are trying
> > to get into a fixed state.
>
> > So better to think "I want to have a bunch of similar-looking resources
> > that are identified and enumerated in an array."
>
> > This leads you to defined
> > types:http://docs.puppetlabs.com/learning/definedtypes.html
>
> > Which is probably the way you should do this.
>
> +1
>
> Be especially aware that you need a "creates" or "onlyif" constraint,
> otherwise puppet will perform your exec through each run.
>
> Here's a pointer:
>
> define proxy_ring($sip) {
>   exec { "account-for-zone$name":
>                 command => "swift-ring-builder account.builder add
> z$name-$sip:6002/sdb1 100",
>                 creates => ?????????!
>                 cwd => "/etc/swift",
>                 require => Class['swift::proxy-install'],
>                 path => ["/bin", "/sbin", "/usr/bin", "/usr/sbin"];
>         "containter-for-zone$name":
>                 ...
>
> }
>
> Use this like
> proxy_ring {
>         "1": $ip1;
>         "2": $ip2;
>         ...
>
> }
>
> If you prefer arrays - that's harder. You could store the definitions in
> a hash and use the create_resources() function.
>
> HTH,
> Felix

-- 
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