2014-06-25 11:44:08 -04:00
|
|
|
---
|
2017-06-14 21:04:16 -04:00
|
|
|
description: |
|
2020-03-18 18:46:47 -04:00
|
|
|
The Vagrant Cloud post-processor enables the upload of Vagrant boxes to
|
|
|
|
Vagrant Cloud.
|
|
|
|
page_title: Vagrant Cloud - Post-Processors
|
2020-04-02 19:39:47 -04:00
|
|
|
sidebar_title: Vagrant Cloud
|
2017-03-25 18:13:52 -04:00
|
|
|
---
|
2014-06-25 11:44:08 -04:00
|
|
|
|
|
|
|
# Vagrant Cloud Post-Processor
|
|
|
|
|
|
|
|
Type: `vagrant-cloud`
|
|
|
|
|
2019-03-11 23:21:59 -04:00
|
|
|
[Vagrant Cloud](https://app.vagrantup.com/boxes/search) hosts and serves boxes
|
|
|
|
to Vagrant, allowing you to version and distribute boxes to an organization in a
|
2018-10-26 20:02:51 -04:00
|
|
|
simple way.
|
2014-06-25 11:44:08 -04:00
|
|
|
|
2019-08-21 11:53:06 -04:00
|
|
|
The Vagrant Cloud post-processor enables the upload of Vagrant boxes to Vagrant
|
|
|
|
Cloud. Currently, the Vagrant Cloud post-processor will accept and upload boxes
|
2020-03-31 17:40:07 -04:00
|
|
|
supplied to it from the [Vagrant](/docs/post-processors/vagrant) or
|
|
|
|
[Artifice](/docs/post-processors/artifice) post-processors and the
|
|
|
|
[Vagrant](/docs/builders/vagrant) builder.
|
2019-08-21 11:53:06 -04:00
|
|
|
|
2015-07-22 22:31:00 -04:00
|
|
|
You'll need to be familiar with Vagrant Cloud, have an upgraded account to
|
|
|
|
enable box hosting, and be distributing your box via the [shorthand
|
2016-01-14 15:31:19 -05:00
|
|
|
name](https://docs.vagrantup.com/v2/cli/box.html) configuration.
|
2014-06-25 11:44:08 -04:00
|
|
|
|
|
|
|
## Workflow
|
|
|
|
|
|
|
|
It's important to understand the workflow that using this post-processor
|
|
|
|
enforces in order to take full advantage of Vagrant and Vagrant Cloud.
|
|
|
|
|
2015-07-22 22:31:00 -04:00
|
|
|
The use of this processor assume that you currently distribute, or plan to
|
|
|
|
distribute, boxes via Vagrant Cloud. It also assumes you create Vagrant Boxes
|
|
|
|
and deliver them to your team in some fashion.
|
2014-06-25 11:44:08 -04:00
|
|
|
|
|
|
|
Here is an example workflow:
|
|
|
|
|
2017-06-14 21:04:16 -04:00
|
|
|
1. You use Packer to build a Vagrant Box for the `virtualbox` provider
|
|
|
|
2. The `vagrant-cloud` post-processor is configured to point to the box
|
|
|
|
`hashicorp/foobar` on Vagrant Cloud via the `box_tag` configuration
|
|
|
|
3. The post-processor receives the box from the `vagrant` post-processor
|
|
|
|
4. It then creates the configured version, or verifies the existence of it, on
|
|
|
|
Vagrant Cloud
|
|
|
|
5. A provider matching the name of the Vagrant provider is then created
|
|
|
|
6. The box is uploaded to Vagrant Cloud
|
|
|
|
7. The upload is verified
|
|
|
|
8. The version is released and available to users of the box
|
2014-06-25 11:44:08 -04:00
|
|
|
|
2020-05-05 11:07:34 -04:00
|
|
|
~> The Vagrant Cloud box (`hashicorp/foobar` in this example) must already
|
|
|
|
exist. Packer will not create the box automatically. If running Packer in
|
|
|
|
automation, consider using the
|
|
|
|
[Vagrant Cloud API](https://www.vagrantup.com/docs/vagrant-cloud/api.html)
|
|
|
|
to create the Vagrant Cloud box if it doesn't already exist.
|
|
|
|
|
2014-06-25 11:44:08 -04:00
|
|
|
## Configuration
|
|
|
|
|
2015-07-22 22:31:00 -04:00
|
|
|
The configuration allows you to specify the target box that you have access to
|
|
|
|
on Vagrant Cloud, as well as authentication and version information.
|
2014-06-25 11:44:08 -04:00
|
|
|
|
|
|
|
### Required:
|
|
|
|
|
2020-03-18 18:46:47 -04:00
|
|
|
- `box_tag` (string) - The shorthand tag for your box that maps to Vagrant
|
|
|
|
Cloud, for example `hashicorp/precise64`, which is short for
|
2020-05-05 11:07:34 -04:00
|
|
|
`vagrantcloud.com/hashicorp/precise64`. This box must already exist in
|
|
|
|
Vagrant Cloud. Packer will not create the box automatically.
|
2014-06-25 11:44:08 -04:00
|
|
|
|
2020-03-18 18:46:47 -04:00
|
|
|
- `version` (string) - The version number, typically incrementing a previous
|
|
|
|
version. The version string is validated based on [Semantic
|
|
|
|
Versioning](http://semver.org/). The string must match a pattern that could
|
|
|
|
be semver, and doesn't validate that the version comes after your previous
|
|
|
|
versions.
|
2014-06-25 11:44:08 -04:00
|
|
|
|
2020-03-18 18:46:47 -04:00
|
|
|
- `access_token` (string) - Your access token for the Vagrant Cloud API. This
|
|
|
|
can be generated on your [tokens
|
|
|
|
page](https://app.vagrantup.com/settings/security). If not specified, the
|
|
|
|
environment will be searched. First, `VAGRANT_CLOUD_TOKEN` is checked, and
|
|
|
|
if nothing is found, finally `ATLAS_TOKEN` will be used. This is required
|
|
|
|
unless you are using a private hosting solution (i.e. `vagrant_cloud_url`
|
|
|
|
has been populated).
|
2019-09-12 06:37:46 -04:00
|
|
|
|
2020-03-18 18:46:47 -04:00
|
|
|
**or**
|
2019-09-12 06:37:46 -04:00
|
|
|
|
2020-03-18 18:46:47 -04:00
|
|
|
- `vagrant_cloud_url` (string) - Override the base URL for Vagrant Cloud.
|
|
|
|
This is useful if you're using Vagrant Private Cloud in your own network.
|
|
|
|
Defaults to `https://vagrantcloud.com/api/v1`. If this value is set to something
|
|
|
|
other than the default then `access_token` can be left blank and no
|
|
|
|
`Authorization` header will be added to requests sent by this post-processor.
|
2019-09-12 06:37:46 -04:00
|
|
|
|
2014-06-25 11:44:08 -04:00
|
|
|
### Optional:
|
|
|
|
|
2020-03-18 18:46:47 -04:00
|
|
|
- `no_release` (string) - If set to true, does not release the version on
|
|
|
|
Vagrant Cloud, making it active. You can manually release the version via
|
|
|
|
the API or Web UI. Defaults to false.
|
2014-06-25 11:44:08 -04:00
|
|
|
|
2020-03-18 18:46:47 -04:00
|
|
|
- `insecure_skip_tls_verify` (boolean) - If set to true _and_ `vagrant_cloud_url`
|
|
|
|
is set to something different than its default, it will set TLS InsecureSkipVerify
|
|
|
|
to true. In other words, this will disable security checks of SSL. You may need
|
|
|
|
to set this option to true if your host at vagrant_cloud_url is using a
|
|
|
|
self-signed certificate.
|
2019-03-06 05:13:25 -05:00
|
|
|
|
2020-03-18 18:46:47 -04:00
|
|
|
- `keep_input_artifact` (boolean) - When true, preserve the local box
|
|
|
|
after uploading to Vagrant cloud. Defaults to `true`.
|
2019-04-03 16:57:22 -04:00
|
|
|
|
2020-03-18 18:46:47 -04:00
|
|
|
- `version_description` (string) - Optionally markdown text used as a
|
|
|
|
full-length and in-depth description of the version, typically for denoting
|
|
|
|
changes introduced
|
2014-07-11 09:21:16 -04:00
|
|
|
|
2020-03-18 18:46:47 -04:00
|
|
|
- `box_download_url` (string) - Optional URL for a self-hosted box. If this
|
|
|
|
is set the box will not be uploaded to the Vagrant Cloud.
|
2021-01-27 09:08:59 -05:00
|
|
|
This is a [template engine](/docs/templates/legacy_json_templates/engine). Therefore, you
|
2020-03-18 18:46:47 -04:00
|
|
|
may use user variables and template functions in this field.
|
|
|
|
The following extra variables are also avilable in this engine:
|
2020-12-04 16:00:53 -05:00
|
|
|
|
2020-03-18 18:46:47 -04:00
|
|
|
- `Provider`: The Vagrant provider the box is for
|
|
|
|
- `ArtifactId`: The ID of the input artifact.
|
2014-08-02 09:14:29 -04:00
|
|
|
|
2020-11-05 20:01:55 -05:00
|
|
|
- `no_direct_upload` (boolean) - When true, upload the box artifact through
|
|
|
|
Vagrant Cloud instead of directly to the backend storage.
|
|
|
|
|
2019-08-21 11:53:06 -04:00
|
|
|
## Use with the Vagrant Post-Processor
|
|
|
|
|
|
|
|
An example configuration is shown below. Note the use of the nested array that
|
|
|
|
wraps both the Vagrant and Vagrant Cloud post-processors within the
|
|
|
|
post-processor section. Chaining the post-processors together in this way tells
|
|
|
|
Packer that the artifact produced by the Vagrant post-processor should be passed
|
|
|
|
directly to the Vagrant Cloud Post-Processor. It also sets the order in which
|
|
|
|
the post-processors should run.
|
2014-06-25 11:44:08 -04:00
|
|
|
|
2019-08-21 11:53:06 -04:00
|
|
|
Failure to chain the post-processors together in this way will result in the
|
|
|
|
wrong artifact being supplied to the Vagrant Cloud post-processor. This will
|
|
|
|
likely cause the Vagrant Cloud post-processor to error and fail.
|
2014-06-25 11:44:08 -04:00
|
|
|
|
2020-03-12 10:05:08 -04:00
|
|
|
```json
|
2014-06-25 11:44:08 -04:00
|
|
|
{
|
2015-03-24 15:41:17 -04:00
|
|
|
"variables": {
|
2019-07-31 11:46:07 -04:00
|
|
|
"cloud_token": "{{ env `VAGRANT_CLOUD_TOKEN` }}",
|
2017-06-13 17:14:28 -04:00
|
|
|
"version": "1.0.{{timestamp}}"
|
2015-03-24 15:41:17 -04:00
|
|
|
},
|
|
|
|
"post-processors": [
|
2019-08-21 11:53:06 -04:00
|
|
|
{
|
|
|
|
"type": "shell-local",
|
|
|
|
"inline": ["echo Doing stuff..."]
|
|
|
|
},
|
2015-03-24 15:41:17 -04:00
|
|
|
[
|
|
|
|
{
|
|
|
|
"type": "vagrant",
|
|
|
|
"include": ["image.iso"],
|
|
|
|
"vagrantfile_template": "vagrantfile.tpl",
|
|
|
|
"output": "proxycore_{{.Provider}}.box"
|
2014-06-25 11:44:08 -04:00
|
|
|
},
|
|
|
|
{
|
2015-03-24 15:41:17 -04:00
|
|
|
"type": "vagrant-cloud",
|
|
|
|
"box_tag": "hashicorp/precise64",
|
|
|
|
"access_token": "{{user `cloud_token`}}",
|
2017-06-13 17:14:28 -04:00
|
|
|
"version": "{{user `version`}}"
|
2015-03-24 15:41:17 -04:00
|
|
|
}
|
2014-06-25 11:44:08 -04:00
|
|
|
]
|
2015-03-24 15:41:17 -04:00
|
|
|
]
|
2014-06-25 11:44:08 -04:00
|
|
|
}
|
|
|
|
```
|
2019-08-21 11:53:06 -04:00
|
|
|
|
|
|
|
## Use with the Artifice Post-Processor
|
|
|
|
|
|
|
|
An example configuration is shown below. Note the use of the nested array that
|
|
|
|
wraps both the Artifice and Vagrant Cloud post-processors within the
|
|
|
|
post-processor section. Chaining the post-processors together in this way tells
|
|
|
|
Packer that the artifact produced by the Artifice post-processor should be
|
|
|
|
passed directly to the Vagrant Cloud Post-Processor. It also sets the order in
|
|
|
|
which the post-processors should run.
|
|
|
|
|
|
|
|
Failure to chain the post-processors together in this way will result in the
|
|
|
|
wrong artifact being supplied to the Vagrant Cloud post-processor. This will
|
|
|
|
likely cause the Vagrant Cloud post-processor to error and fail.
|
|
|
|
|
|
|
|
Note that the Vagrant box specified in the Artifice post-processor `files` array
|
|
|
|
must end in the `.box` extension. It must also be the first file in the array.
|
|
|
|
Additional files bundled by the Artifice post-processor will be ignored.
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"variables": {
|
2020-03-18 18:46:47 -04:00
|
|
|
"cloud_token": "{{ env `VAGRANT_CLOUD_TOKEN` }}"
|
2019-08-21 11:53:06 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
"builders": [
|
|
|
|
{
|
|
|
|
"type": "null",
|
|
|
|
"communicator": "none"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
|
|
|
|
"post-processors": [
|
|
|
|
{
|
|
|
|
"type": "shell-local",
|
|
|
|
"inline": ["echo Doing stuff..."]
|
|
|
|
},
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"type": "artifice",
|
2020-03-18 18:46:47 -04:00
|
|
|
"files": ["./path/to/my.box"]
|
2019-08-21 11:53:06 -04:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "vagrant-cloud",
|
|
|
|
"box_tag": "myorganisation/mybox",
|
|
|
|
"access_token": "{{user `cloud_token`}}",
|
2020-03-18 18:46:47 -04:00
|
|
|
"version": "0.1.0"
|
2019-08-21 11:53:06 -04:00
|
|
|
}
|
|
|
|
]
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|