Add docs and nav reference

This commit is contained in:
Gennady Lipenkov 2020-04-27 02:21:13 +03:00
parent d5a6781fb7
commit 17a5b5db24
4 changed files with 116 additions and 0 deletions

View File

@ -256,6 +256,7 @@ export default [
'vagrant-cloud',
'vsphere',
'vsphere-template',
'yandex-export',
],
},
'----------',

View File

@ -0,0 +1,88 @@
---
description: >
The Yandex.Cloud Compute Image Exporter post-processor exports an image from a
Packer
yandex builder run and uploads it to Yandex Object Storage. The exported
images can be easily shared and uploaded to other Yandex.Cloud Cloud folders.
layout: docs
page_title: Yandex.Cloud Compute Image Exporter - Post-Processors
sidebar_title: Yandex.Cloud Compute Export
---
# Yandex.Cloud Compute Image Exporter Post-Processor
Type: `yandex-export`
The Yandex.Cloud Compute Image Exporter post-processor exports the resultant image
from a yandex build as a qcow2 file to Yandex Object Storage.
The exporter uses the same Yandex.Cloud folder and
authentication credentials as the yandex build that produced the image.
A temporary VM is started in the folder using these credentials. The VM
mounts the built image as a secondary disk, then dumps the image in qcow2 format.
The VM then uploads the file to the provided Yandex Object Storage `paths` using the same
credentials.
As such, assigned Service Account must have write permissions to the Yandex Object Storage
`paths`. A new temporary static access keys from assigned Service Account used to upload
image.
## Configuration
### Required:
@include 'post-processor/yandex-export/Config-required.mdx'
### Optional:
@include 'post-processor/yandex-export/Config-not-required.mdx'
## Basic Example
The following example builds a Compute image in the folder with id `b1g8jvfcgmitdrslcn86`, with an
Service Account whose keyfile is `account.json`. After the image build, a temporary VM
will be created to export the image as a qcow2 file to
`s3://packer-export/my-exported-image.qcow2` and
`s3://packer-export/image-number-two.qcow2`. `keep_input_artifact` is true, so the
source Compute image won't be deleted after the export.
In order for this example to work, the service account associated with builder
must have write access to both `s3://packer-export/my-exported-image.qcow2` and
`s3://packer-export/image-number-two.qcow2` and get permission to modify temporary instance
(create new disk, attach to instance, etc).
```json
{
"builders": [
{
"type": "yandex",
"folder_id": "b1g8jvfcgmitdrslcn86",
"subnet_id": "e9bp6l8sa4q39yourxzq",
"zone": "ru-central1-a"
"source_image_family": "ubuntu-1604-lts",
"ssh_username": "ubuntu",
"use_ipv4_nat": true,
}
],
"post-processors": [
{
"type": "yandex-export",
"folder_id": "b1g8jvfcgmitdrslcn86",
"subnet_id": "e9bp6l8sa4q39yourxzq",
"service_account_id": "ajeu0363240rrnn7xgen",
"paths": [
"s3://packer-export-bucket/my-exported-image.qcow2",
"s3://packer-export-bucket/image-number-two.qcow2"
],
"keep_input_artifact": true
}
]
}```

View File

@ -0,0 +1,17 @@
<!-- Code generated from the comments of the Config struct in post-processor/yandex-export/post-processor.go; DO NOT EDIT MANUALLY -->
- `disk_size` (int) - The size of the disk in GB. This defaults to `100`, which is 100GB.
- `disk_type` (string) - Specify disk type for the launched instance. Defaults to `network-ssd`.
- `platform_id` (string) - Identifier of the hardware platform configuration for the instance. This defaults to `standard-v2`.
- `subnet_id` (string) - The Yandex VPC subnet id to use for
the launched instance. Note, the zone of the subnet must match the
zone in which the VM is launched.
- `zone` (string) - The name of the zone to launch the instance. This defaults to `ru-central1-a`.
- `token` (string) - OAuth token to use to authenticate to Yandex.Cloud. Alternatively you may set
value by environment variable YC_TOKEN.

View File

@ -0,0 +1,10 @@
<!-- Code generated from the comments of the Config struct in post-processor/yandex-export/post-processor.go; DO NOT EDIT MANUALLY -->
- `paths` ([]string) - Paths to Yandex Object Storage where exported image will be uploaded
- `folder_id` (string) - The folder ID that will be used to launch a temporary instance.
Alternatively you may set value by environment variable YC_FOLDER_ID.
- `service_account_id` (string) - Service Account ID with proper permission to modify an instance, create and attach disk and
make upload to specific paths