I like rather to have the script outside of chef, it is easier to perform troubleshooting (from my point of view) then and also in case of change in automation solution (for example a move to puppet) smaller amount of changes is needed to move the script to the new environment ;)BR,Rafal.2015-03-19 16:10 GMT+01:00 Jeff Byrnes < " target="_blank"> >:Rafal:So yes, the ruby_block resource is for an inline block of Ruby code you want to run within the context of the Chef execution.As for your execute resource, that appears to a way to do it. Curious though; is there any reason you wouldn’t write your script as a library for your cookbook, and then use the ruby_block resource to execute it? Do you need the script outside of the scope of Chef convergences?
On March 19, 2015 at 10:27:54 AM, Rafał Radecki ( " target="_blank"> ) wrote:
Hi All :)I am trying to run a ruby script with /opt/chef-server/embedded/bin/ruby interpreter during chef-client run.This works:execute 'process_something' doaction :runcommand '/opt/chef-server/embedded/bin/ruby /usr/local/bin/process_something.rb'endThese do not work:ruby 'process_something' doaction :runcommand '/opt/chef-server/embedded/bin/ruby /usr/local/bin/process_something.rb'endandruby 'process_something' doaction :runcommand '/usr/local/bin/process_something.rb'endI run the cookbook with '-l debug' but eventually got only:[2015-03-19T14:24:41+00:00] INFO: ruby[process_something] ran successfullyin the logs.Can anyone tell me how to run a ruby script during chef-client run with interpreter from /opt/chef-server/embedded/bin/ruby or /opt/chef/embedded/bin/ruby?I know that I can use ruby_code resource but I am under impression that it should be used rather for blocks of ruby code and not for scripts, is it so?BR,Rafal.
Archive powered by MHonArc 2.6.16.