returning a value from a provision script to vagra

2019-06-26 06:02发布

问题:

Is it possible to return a value from a provision script back to vagrant?

response = config.vm.provision( "shell", path: "script.sh" )

if response = 'ok'
   do_something
end

I couldn't see anything in the vagrant docs describing how this could be done.

回答1:

As far as I am aware I don't think it is possible to return a value like that.

You can however easily get around this by having your provisioning script write a file in the /vagrant directory of the guest machine.

You can then use Ruby to process this file which will be in the same folder as your Vagrantfile.



标签: vagrant