Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to package files with a Vagrant box?

So I created a Vagrant box with the following command:

vagrant package --base box_name_here --vagrantfile Vagrantfile --include manifests/

manifests/ is a directory with a puppet manifest and some subdirectories with some files used during the provisioning process. Puppet is called in the Vagrantfile like so:

config.vm.provision :puppet do |puppet|
    puppet.manifests_path = "manifests"
    puppet.manifest_file  = "web-dev.pp"
end

When I explore the packaged .box archive Vagrant creates, I see the folder located at box_name_here.box/includes/manifests. However, vagrant up dies with the following error when I try to run it:

The manifests path specified for Puppet does not exist: c:/vagrant/manifests

Are the files somewhere else?

I saw this post: https://github.com/mitchellh/vagrant/issues/344

But the answer is a bit opaque; I don't quite know how to translate the modulepath response to my manifests_path problem.

I altered the vagrantfile so that the line reads

puppet.manifests_path = "./manifests"

...but that did not correct the problem. I still get the same error message.

like image 848
jeremiahs Avatar asked Dec 29 '12 17:12

jeremiahs


1 Answers

After some experimentation, the incredibly obvious answer is:

puppet.manifests_path = File.expand_path("../manifests", __FILE__)
like image 109
jeremiahs Avatar answered Oct 05 '22 05:10

jeremiahs