I use Vagrant to spawn a standard \"precise32\" box and provision it with Chef so I can test my Node.js code on Linux when I work on a Windows machine. This works fine.
Use the live_stream
attribute of the execute
resource
execute 'foo' do
command 'cat /etc/hosts'
live_stream true
action :run
end
Script output will be printed to the console
Starting Chef Client, version 12.18.31
resolving cookbooks for run list: ["apt::default", "foobar::default"]
Synchronizing Cookbooks:
Converging 2 resources
Recipe: foobar::default
* execute[foo] action run
[execute] 127.0.0.1 default-ubuntu-1604 default-ubuntu-1604
127.0.0.1 localhost
127.0.1.1 vagrant.vm vagrant
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
- execute cat /etc/hosts
https://docs.chef.io/resource_execute.html