github.com/mmcquillan/packer@v1.1.1-0.20171009221028-c85cf0483a5d/website/source/docs/post-processors/vagrant.html.md (about)

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