I'm building a vagrant .box file using packer. I've got something like this in my packer .json config:
"post-processors": [
//SNIP
"include": [
"./choco.ps1",
"./vagrantUp.ps1",
]
]
It's building the .box, and if I manually untar the file I can see those are included in there. When I end up running "vagrant box add Mybox http://whatever" I can even see them in my ~/.vagrant.d/boxes/MyBox/0/virtualbox folder.
~ $ ls ~/.vagrant.d/boxes/MyBox/0/virtualbox/
Vagrantfile metadata.json
box.ovf packer-virtualbox-iso-1424829938-disk1.vmdk
choco.ps1 vagrantUp.ps1
Also, in my packer vagrant template I have a line:
config.vm.provision "shell", path: "vagrantUp.ps1"
Next, I want to initialize this machine. I did the following:
~ $ cd ~/Vagrant
Vagrant $ Vagrant mkdir MyBox; cd MyBox
MyBox $ vagrant init MyBox
MyBox $ ls
VagrantFile
This file looks like the basic vagrant default, but at the top it mentions config.vm.box = "MyBox"
.
But then if I vagrant up
, I get the following error:
* `path` for shell provisioner does not exist on the host system: /Users/me/Vagrant/MyBox/vagrantUp.ps1
It looks to me like the VagrantFile in /Vagrant/MyBox is referencing the VagrantFile in ~/.vagrant.d/, which is good, that's what I want. But then it's still using the paths relative to /Vagrant/MyBox, when the files are actually relative to ~/.vagrant.d/
Am I missing a step that tells vagrant to copy those files to the instance directory? Or am I referencing them incorrectly in my vagrant template?