shell - How to Execute Script After Download? -
the code below supposed download script , execute on vagrant guest. script downloaded, never run. know how ensure execution of shell script after download?
remote_file "/home/vagrant/conscript_setup.sh" source "#{node.default['conscript']['url']}" notifies :run, "bash[install conscript]", :immediately end bash "install conscript" cwd "/home/vagrant" code <<-eoh cwd "/home/vagrant" chown vagrant:vagrant conscript_setup.sh chmod 777 conscript_setup.sh conscript_setup.sh eoh end
when run script, need full (absolute) path not in shell's execute path.
i have working example (similar), reference
temp=chef::config[:file_cache_path] remote_file "#{chef::config[:file_cache_path]}/screenfetch.sh" source "https://raw.github.com/kittykatt/screenfetch/master/screenfetch-dev" mode 00755 end bash 'screenfetch' code <<-eof #{temp}/./screenfetch.sh > #{temp}/screenfetch.log 2>/dev/null eof end
mode bit set @ download time. can change recipe accordingly.
btw: can enable debug see more information
for chef-solo
=> chef-solo -c solo.rb -j node.json -l debug
vagrant + chef solo example (use chef.arguments
)
config.vm.provision :chef_solo |chef| # vagrant + chef-solo provision log level # equivalent vagrant_log=info vagrant chef.arguments = "-l debug" chef.add_recipe "apt" chef.add_recipe "nginx" end
if chef-arguments
not work, vagrant_log=debug vagrant up
Comments
Post a Comment