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