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