[chef] Run ruby script during chef-client run?


Chronological Thread 
  • From: Rafał Radecki < >
  • To:
  • Subject: [chef] Run ruby script during chef-client run?
  • Date: Thu, 19 Mar 2015 15:27:41 +0100

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' do
        action :run
        command '/opt/chef-server/embedded/bin/ruby /usr/local/bin/process_something.rb'
end

These do not work:

ruby 'process_something' do
        action :run
        command '/opt/chef-server/embedded/bin/ruby /usr/local/bin/process_something.rb'
end

and

ruby 'process_something' do
        action :run
        command '/usr/local/bin/process_something.rb'
end

I run the cookbook with '-l debug' but eventually got only:

[2015-03-19T14:24:41+00:00] INFO: ruby[process_something] ran successfully

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

§