Hi,

I have written a sample manifest in puppet using Ruby DSL. I want to
build a looping functionality. But I am getting problem as shown
below:

root@puppet-swproxy:/tmp# cat test.rb
hostclass :test do
$abc = ["a","b"]
$abc.each do |sip|
  create_resource :exec, "echoabc", :command => "echo #{sip}"
end

file "/tmp/testecho.txt", :content => "This is test file", :require =>
Exec['echoabc']
end

node "default" do
include "test"
end
root@puppet-swproxy:/tmp# puppet apply --verbose test.rb
Duplicate definition: Exec[echoabc] is already defined on node puppet-
swproxy.persistent.co.in

I can make the echoabc as dynamic, but how can specify that in require
in next statement (file). I need to execute the file only after
executing the exec. So what I need to do. Generall the puppet will not
run in the synchronized way. I observed that the statements are
executed asynchronously.

Also, I need to define the Exec path at the top as I specified in the
pp file.

  Exec {
    path => ["/bin", "/sbin", "/usr/bin", "/usr/sbin"],
  }

How to write this in Ruby DSL. So that I can eliminate the path
attribute in all exec statements.

Thanks in advance,
Sateesh B.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to [email protected].
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.

Reply via email to