Creating a custom Vagrantfile from Packer

I was trying to figure out how to create a custom vagrant file from the packer, I understand that in the section post-processor

you define a directory from which to opt out, I don't understand if it is necessary to be a specific named file within which data can be collected.

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

      

The above code, as far as I know, will look underneath configs/vagrantfile_template

, but what would be needed here? Would I create Vagrantfile

and put it there, or did it need to be specifically named a Ruby file?

+3


source to share


1 answer


The option vagrantfile_template

in the post-processor vagrant

points directly to the file, not the directory [0]. The content of this file should be structured like a regular Vagrantfile and contain any settings for the generated artifact.

For example, if you want the users of your custom Vagrant window not to have the /vagrant

default shared folder set, your template Vagrantfile

might look like this:

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

      



Resources

+5


source







All Articles