[chef] How to define a variable into an execution command


Chronological Thread 
  • From: WEINHAPL Andreas < >
  • To: " " < >
  • Subject: [chef] How to define a variable into an execution command
  • Date: Wed, 16 Mar 2011 15:01:29 +0100
  • Accept-language: en-US, fr-FR
  • Acceptlanguage: en-US, fr-FR

Hi,

 

I have a problem with my executing command string in chef, because it doesn’t see my declaration as a variable instead he will use the “name” of the variable.  I tried it with attributes aso but the result will be the same L

 

This is my recipe:

 

Recipe:default.rb:

# Update and restart ntp-deamon

# NTP is the variable for Server1(first) and the Server(second)

 

execute "Set time to NTP Time now" do

   command '/usr/sbin/ntpdate <%= node[:ntp][:first] %>'  => should be “command ‘/usr/sbin/ntpdate 217.0.0.1’ “

  action :run

end

 

That is what chef will see if I execute it:

handle_command_failures': /usr/sbin/ntpdate <%= node[:ntp][:first] %> returned 2, expected 0

 

Have anybody a similar problem and could resolve it?!

 

Best regards and thanks for the help

Andreas




Archive powered by MHonArc 2.6.16.

§