Vagrant File Template

542 views
Skip to first unread message

enq...@polycademy.com

unread,
May 14, 2014, 4:07:10 AM5/14/14
to packe...@googlegroups.com
Can the vagrant file template reference variables defined inside the variables section of the packer.json?

On the documentation it says:

vagrantfile_template (string) - Path to a template to use for the Vagrantfile that is packaged with the box.

If it is a template, is it a template, does it mean it's a configuration template? (http://www.packer.io/docs/templates/configuration-templates.html)

If so I would like to use my previously defined variables in the variables section such as:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
    config.vm.box = "nixos-{{user `nixos_version`}}-{{user `nixos_build`}}"
    config.vm.box_url = "./nixos-{{user `nixos_version`}}-{{user `nixos_build`}}.box"
end

But I don't think I have the right syntax.

Mike Dillion

unread,
May 14, 2014, 12:30:49 PM5/14/14
to packe...@googlegroups.com
The `vagrantfile_template` is an attribute on the Vagrant Post-Processor. The Vagrantfile it generates will actually be inside of the box artifact (every box has an internal Vagrantfile for things like hardware addresses.




--
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alvaro Miranda Aguilera

unread,
May 14, 2014, 7:23:24 PM5/14/14
to packe...@googlegroups.com
Hello,

I will suggest give a try first using a vagrant file with the values hardcoded, since everytime I have tried, the only value taken is the mac address, so those config.vm.box*, based on what I have seen are very unluckily will be imported.

Please test and report back, perhaps I was doing something wrong, or the new 0.6 packer does different.

After that, you can test options.

With packer and shell you can mount a shared folder and create a vagrant file with some shell providder, etc, but please be sure those values will ever get imported/used once you deploy the box.

Alvaro.


--

enq...@polycademy.com

unread,
May 15, 2014, 4:27:11 AM5/15/14
to packe...@googlegroups.com
Can you give an example packer.json file?

Alvaro Miranda Aguilera

unread,
May 15, 2014, 6:50:33 PM5/15/14
to packe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages