github.com/askholme/packer@v0.7.2-0.20140924152349-70d9566a6852/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](http://docs.vagrantup.com/v2/boxes/format.html),
    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  * DigitalOcean
    31  * Hyper-V
    32  * Parallels
    33  * VirtualBox
    34  * VMware
    35  
    36  <div class="alert alert-block alert-info">
    37  <strong>Support for additional providers</strong> is planned. If the
    38  Vagrant post-processor doesn't support creating boxes for a provider you
    39  care about, please help by contributing to Packer and adding support for it.
    40  </div>
    41  
    42  ## Configuration
    43  
    44  The simplest way to use the post-processor is to just enable it. No
    45  configuration is required by default. This will mostly do what you expect
    46  and will build functioning boxes for many of the built-in builders of
    47  Packer.
    48  
    49  However, if you want to configure things a bit more, the post-processor
    50  does expose some configuration options. The available options are listed
    51  below, with more details about certain options in following sections.
    52  
    53  * `compression_level` (integer) - An integer repesenting the
    54    compression level to use when creating the Vagrant box.  Valid
    55    values range from 0 to 9, with 0 being no compression and 9 being
    56    the best compression. By default, compression is enabled at level 6.
    57  
    58  * `include` (array of strings) - Paths to files to include in the
    59    Vagrant box. These files will each be copied into the top level directory
    60    of the Vagrant box (regardless of their paths). They can then be used
    61    from the Vagrantfile.
    62  
    63  * `keep_input_artifact` (boolean) - If set to true, do not delete the
    64    `output_directory` on a successful build. Defaults to false.
    65  
    66  * `output` (string) - The full path to the box file that will be created
    67    by this post-processor. This is a
    68    [configuration template](/docs/templates/configuration-templates.html).
    69    The variable `Provider` is replaced by the Vagrant provider the box is for.
    70    The variable `ArtifactId` is replaced by the ID of the input artifact.
    71    The variable `BuildName` is replaced with the name of the build.
    72    By default, the value of this config is `packer_{{.BuildName}}_{{.Provider}}.box`.
    73  
    74  * `vagrantfile_template` (string) - Path to a template to use for the
    75    Vagrantfile that is packaged with the box.
    76  
    77  ## Provider-Specific Overrides
    78  
    79  If you have a Packer template with multiple builder types within it,
    80  you may want to configure the box creation for each type a little differently.
    81  For example, the contents of the Vagrantfile for a Vagrant box for AWS might
    82  be different from the contents of the Vagrantfile you want for VMware.
    83  The post-processor lets you do this.
    84  
    85  Specify overrides within the `override` configuration by provider name:
    86  
    87  ```json
    88  {
    89      "type": "vagrant",
    90  
    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.