github.com/tonnydourado/packer@v0.6.1-0.20140701134019-5d0cd9676a37/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  * Parallels
    32  * VirtualBox
    33  * VMware
    34  
    35  <div class="alert alert-block alert-info">
    36  <strong>Support for additional providers</strong> is planned. If the
    37  Vagrant post-processor doesn't support creating boxes for a provider you
    38  care about, please help by contributing to Packer and adding support for it.
    39  </div>
    40  
    41  ## Configuration
    42  
    43  The simplest way to use the post-processor is to just enable it. No
    44  configuration is required by default. This will mostly do what you expect
    45  and will build functioning boxes for many of the built-in builders of
    46  Packer.
    47  
    48  However, if you want to configure things a bit more, the post-processor
    49  does expose some configuration options. The available options are listed
    50  below, with more details about certain options in following sections.
    51  
    52  * `compression_level` (integer) - An integer repesenting the
    53    compression level to use when creating the Vagrant box.  Valid
    54    values range from 0 to 9, with 0 being no compression and 9 being
    55    the best compression. By default, compression is enabled at level 6.
    56  
    57  * `include` (array of strings) - Paths to files to include in the
    58    Vagrant box. These files will each be copied into the top level directory
    59    of the Vagrant box (regardless of their paths). They can then be used
    60    from the Vagrantfile.
    61  
    62  * `keep_input_artifact` (boolean) - If set to true, do not delete the
    63    `output_directory` on a successful build. Defaults to false.
    64  
    65  * `output` (string) - The full path to the box file that will be created
    66    by this post-processor. This is a
    67    [configuration template](/docs/templates/configuration-templates.html).
    68    The variable `Provider` is replaced by the Vagrant provider the box is for.
    69    The variable `ArtifactId` is replaced by the ID of the input artifact.
    70    The variable `BuildName` is replaced with the name of the build.
    71    By default, the value of this config is `packer_{{.BuildName}}_{{.Provider}}.box`.
    72  
    73  * `vagrantfile_template` (string) - Path to a template to use for the
    74    Vagrantfile that is packaged with the box.
    75  
    76  ## Provider-Specific Overrides
    77  
    78  If you have a Packer template with multiple builder types within it,
    79  you may want to configure the box creation for each type a little differently.
    80  For example, the contents of the Vagrantfile for a Vagrant box for AWS might
    81  be different from the contents of the Vagrantfile you want for VMware.
    82  The post-processor lets you do this.
    83  
    84  Specify overrides within the `override` configuration by provider name:
    85  
    86  ```json
    87  {
    88      "type": "vagrant",
    89  
    90      "compression_level": 1,
    91      "override": {
    92          "vmware": {
    93              "compression_level": 0
    94          }
    95      }
    96  }
    97  ```
    98  
    99  In the example above, the compression level will be set to 1 except for
   100  VMware, where it will be set to 0.
   101  
   102  The available provider names are: `aws`, `digitalocean`, `virtualbox`,
   103  `vmware`, and `parallels`.
   104  
   105  ## Input Artifacts
   106  
   107  By default, Packer will delete the original input artifact, assuming
   108  you only want the final Vagrant box as the result. If you wish to keep the
   109  input artifact (the raw virtual machine, for example), then you must
   110  configure Packer to keep it.
   111  
   112  Please see the [documentation on input artifacts](/docs/templates/post-processors.html#toc_2)
   113  for more information.