github.com/aspring/packer@v0.8.1-0.20150629211158-9db281ac0f89/website/source/docs/post-processors/vagrant.html.markdown (about) 1 --- 2 layout: "docs" 3 page_title: "Vagrant Post-Processor" 4 description: |- 5 The Packer Vagrant post-processor takes a build and converts the artifact into a valid Vagrant box, if it can. This lets you use Packer to automatically create arbitrarily complex Vagrant boxes, and is in fact how the official boxes distributed by Vagrant are created. 6 --- 7 8 # Vagrant Post-Processor 9 10 Type: `vagrant` 11 12 The Packer Vagrant post-processor takes a build and converts the artifact 13 into a valid [Vagrant](http://www.vagrantup.com) box, if it can. 14 This lets you use Packer to automatically create arbitrarily complex 15 Vagrant boxes, and is in fact how the official boxes distributed by 16 Vagrant are created. 17 18 If you've never used a post-processor before, please read the 19 documentation on [using post-processors](/docs/templates/post-processors.html) 20 in templates. This knowledge will be expected for the remainder of 21 this document. 22 23 Because Vagrant boxes are [provider-specific](http://docs.vagrantup.com/v2/boxes/format.html), 24 the Vagrant post-processor is hardcoded to understand how to convert 25 the artifacts of certain builders into proper boxes for their 26 respective providers. 27 28 Currently, the Vagrant post-processor can create boxes for the following 29 providers. 30 31 * AWS 32 * DigitalOcean 33 * Hyper-V 34 * Parallels 35 * QEMU 36 * VirtualBox 37 * VMware 38 39 -> **Support for additional providers** is planned. If the 40 Vagrant post-processor doesn't support creating boxes for a provider you 41 care about, please help by contributing to Packer and adding support for it. 42 43 ## Configuration 44 45 The simplest way to use the post-processor is to just enable it. No 46 configuration is required by default. This will mostly do what you expect 47 and will build functioning boxes for many of the built-in builders of 48 Packer. 49 50 However, if you want to configure things a bit more, the post-processor 51 does expose some configuration options. The available options are listed 52 below, with more details about certain options in following sections. 53 54 * `compression_level` (integer) - An integer representing the 55 compression level to use when creating the Vagrant box. Valid 56 values range from 0 to 9, with 0 being no compression and 9 being 57 the best compression. By default, compression is enabled at level 6. 58 59 * `include` (array of strings) - Paths to files to include in the 60 Vagrant box. These files will each be copied into the top level directory 61 of the Vagrant box (regardless of their paths). They can then be used 62 from the Vagrantfile. 63 64 * `keep_input_artifact` (boolean) - If set to true, do not delete the 65 `output_directory` on a successful build. Defaults to false. 66 67 * `output` (string) - The full path to the box file that will be created 68 by this post-processor. This is a 69 [configuration template](/docs/templates/configuration-templates.html). 70 The variable `Provider` is replaced by the Vagrant provider the box is for. 71 The variable `ArtifactId` is replaced by the ID of the input artifact. 72 The variable `BuildName` is replaced with the name of the build. 73 By default, the value of this config is `packer_{{.BuildName}}_{{.Provider}}.box`. 74 75 * `vagrantfile_template` (string) - Path to a template to use for the 76 Vagrantfile that is packaged with the box. 77 78 ## Provider-Specific Overrides 79 80 If you have a Packer template with multiple builder types within it, 81 you may want to configure the box creation for each type a little differently. 82 For example, the contents of the Vagrantfile for a Vagrant box for AWS might 83 be different from the contents of the Vagrantfile you want for VMware. 84 The post-processor lets you do this. 85 86 Specify overrides within the `override` configuration by provider name: 87 88 ```javascript 89 { 90 "type": "vagrant", 91 "compression_level": 1, 92 "override": { 93 "vmware": { 94 "compression_level": 0 95 } 96 } 97 } 98 ``` 99 100 In the example above, the compression level will be set to 1 except for 101 VMware, where it will be set to 0. 102 103 The available provider names are: `aws`, `digitalocean`, `virtualbox`, 104 `vmware`, and `parallels`. 105 106 ## Input Artifacts 107 108 By default, Packer will delete the original input artifact, assuming 109 you only want the final Vagrant box as the result. If you wish to keep the 110 input artifact (the raw virtual machine, for example), then you must 111 configure Packer to keep it. 112 113 Please see the [documentation on input artifacts](/docs/templates/post-processors.html#toc_2) 114 for more information.