Alex Cohen Alex Cohen - 1 year ago 140
Bash Question

Vagrant 1.8.4, cant run provisioner shell from a file

I had to downgrade my vagrant version do to conflicts with chef. Now I am using Vagrant 1.8.4, but I have encountered a problem with the provisioner function. This function should use the
file that is present in the same directory as my vagrant file to bootstrap the instance I am creating. Here is my Vagrantfile:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure(2) do |config|

#gives the instances 1 extra network eth interfaces "private_network", type: "dhcp"

#creates instances, defines linux image, hostname and a script to run on creation
config.vm.define "web1" do |web1| = "trusty64"
web1.vm.hostname = "web1"
#this will run the script that is in the same directory as the Vagrantfile
config.vm.provision :shell, path ""

When running
vagrant up
I get the following error:

There is a syntax error in the following Vagrantfile. The syntax error
message is reproduced below for convenience:

/path/to/my/dir/Vagrantfile:14: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '('
config.vm.provision :shell, path ""

What is the correct syntax for using a provisioner file in Vagrant 1.8.4?

Answer Source

There's 2 ways to write it in ruby

config.vm.provision "shell", path: ""

or you could write

config.vm.provision :shell, :path => ""
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download