ehime
ehime

Reputation: 8375

Creating a custom Vagrantfile from Packer

I've been trying to figure out how to create a custom vagrant file from packer, I understand that in the post-processor section you will define a directory from which to scrap from, what I do not understand is if there needs to be a specifically named file inside as to which to gather data from.

"post-processors": [{
  "vagrantfile_template": "configs/vagrantfile_template",
  "type": "vagrant"
}],

The above code to my knowledge would look under configs/vagrantfile_template, but what would need to be in here? Would I create a Vagrantfile and place it there, or would it need to be a specifically named Ruby file?

Upvotes: 3

Views: 1939

Answers (1)

cookrn
cookrn

Reputation: 331

The vagrantfile_template option in a vagrant post-processor points directly to a file and not a directory [0]. The contents of this file should be structured like a normal Vagrantfile and contain any customizations for the box artifact that you are creating.

For example, if you wanted users of your custom Vagrant box to not have the /vagrant shared folder mounted by default, your Vagrantfile template might look like this...

Vagrant.configure("2") do |config|
  config.vm.synced_folder \
    ".",
    "/vagrant",
    :disabled => true
end

Resources

Upvotes: 5

Related Questions