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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With