github.com/phobos182/packer@v0.2.3-0.20130819023704-c84d2aeffc68/website/source/docs/post-processors/vagrant.html.markdown (about) 1 --- 2 layout: "docs" 3 page_title: "Vagrant Post-Processor" 4 --- 5 6 # Vagrant Post-Processor 7 8 Type: `vagrant` 9 10 The Vagrant post-processor takes a build and converts the artifact 11 into a valid [Vagrant](http://www.vagrantup.com) box, if it can. 12 This lets you use Packer to automatically create arbitrarily complex 13 Vagrant boxes, and is in fact how the official boxes distributed by 14 Vagrant are created. 15 16 If you've never used a post-processor before, please read the 17 documentation on [using post-processors](/docs/templates/post-processors.html) 18 in templates. This knowledge will be expected for the remainder of 19 this document. 20 21 Because Vagrant boxes are [provider-specific](#), 22 the Vagrant post-processor is hardcoded to understand how to convert 23 the artifacts of certain builders into proper boxes for their 24 respective providers. 25 26 Currently, the Vagrant post-processor can create boxes for the following 27 providers. 28 29 * AWS 30 * VirtualBox 31 * VMware 32 33 <div class="alert alert-block alert-info"> 34 <strong>Support for additional providers</strong> is planned. If the 35 Vagrant post-processor doesn't support creating boxes for a provider you 36 care about, please help by contributing to Packer and adding support for it. 37 </div> 38 39 ## Configuration 40 41 The simplest way to use the post-processor is to just enable it. No 42 configuration is required by default. This will mostly do what you expect 43 and will build functioning boxes for many of the built-in builders of 44 Packer. 45 46 However, if you want to configure things a bit more, the post-processor 47 does expose some configuration options. The available options are listed 48 below, with more details about certain options in following sections. 49 50 * `output` (string) - The full path to the box file that will be created 51 by this post-processor. This is a 52 [configuration template](/docs/templates/configuration-templates.html). 53 The variable `Provider` is replaced by the Vagrant provider the box is for. 54 The variable `ArtifactId` is replaced by the ID of the input artifact. 55 By default, the value of this config is `packer_{{.Provider}}.box`. 56 57 * `aws`, `virtualbox`, or `vmware` (objects) - These are used to configure 58 the specific options for certain providers. A reference of available 59 configuration parameters for each is in the section below. 60 61 ### AWS Provider 62 63 The AWS provider itself can be configured with specific options: 64 65 * `vagrantfile_template` (string) - Path to a template to use for the 66 Vagrantfile that is packaged with the box. The contents of the file must be a valid Go 67 [text template](http://golang.org/pkg/text/template). By default 68 this is a template that simply sets the AMIs for the various regions 69 of the AWS build. 70 71 The `vagrantfile_template` has the `Images` variable which is a map 72 of region (string) to AMI ID (string). An example Vagrantfile template for 73 AWS is shown below. The example simply sets the AMI for each region. 74 75 ``` 76 Vagrant.configure("2") do |config| 77 config.vm.provider "aws" do |aws| 78 {{ range $region, $ami := .Images }} 79 aws.region_config "{{ $region }}", ami: "{{ $ami }}" 80 {{ end }} 81 end 82 end 83 ``` 84 85 ### VirtualBox Provider 86 87 The VirtualBox provider itself can be configured with specific options: 88 89 * `vagrantfile_template` (string) - Path to a template to use for the 90 Vagrantfile that is packaged with the box. The contents of the file must be a valid Go 91 [text template](http://golang.org/pkg/text/template). By default this is 92 a template that just sets the base MAC address so that networking works. 93 94 The `vagrantfile_template` has the `BaseMACAddress` variable which is a string 95 containing the MAC address of the first network interface. This must be set 96 in the Vagrantfile for networking to work properly with Vagrant. An example 97 Vagrantfile template is shown below: 98 99 ``` 100 Vagrant.configure("2") do |config| 101 config.vm.base_mac = "{{ .BaseMacAddress }}" 102 end 103 ``` 104 105 ### VMware Provider 106 107 The VMware provider itself can be configured with specific options: 108 109 * `vagrantfile_template` (string) - Path to a template to use for the 110 Vagrantfile that is packaged with the box. The contents of the file must be a valid Go 111 [text template](http://golang.org/pkg/text/template). By default no 112 Vagrantfile is packaged with the box. Note that currently no variables 113 are available in the template, but this may change in the future.