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