mirror of https://github.com/hashicorp/packer
parent
61f9d3a9fe
commit
2c513fce64
@ -0,0 +1,25 @@
|
||||
install
|
||||
cdrom
|
||||
lang en_US.UTF-8
|
||||
keyboard us
|
||||
network --bootproto=dhcp
|
||||
rootpw ucloud_2019
|
||||
firewall --disabled
|
||||
selinux --permissive
|
||||
timezone UTC
|
||||
unsupported_hardware
|
||||
bootloader --location=mbr
|
||||
text
|
||||
skipx
|
||||
zerombr
|
||||
clearpart --all
|
||||
autopart
|
||||
auth --enableshadow --passalgo=sha512
|
||||
firstboot --disabled
|
||||
reboot
|
||||
|
||||
%packages --nobase --ignoremissing
|
||||
sudo
|
||||
gcc
|
||||
make
|
||||
%end
|
||||
@ -1,42 +0,0 @@
|
||||
install
|
||||
cdrom
|
||||
lang en_US.UTF-8
|
||||
keyboard us
|
||||
network --bootproto=dhcp
|
||||
rootpw vagrant
|
||||
firewall --disabled
|
||||
selinux --permissive
|
||||
timezone UTC
|
||||
unsupported_hardware
|
||||
bootloader --location=mbr
|
||||
text
|
||||
skipx
|
||||
zerombr
|
||||
clearpart --all
|
||||
autopart
|
||||
auth --enableshadow --passalgo=sha512
|
||||
firstboot --disabled
|
||||
reboot
|
||||
user --name=vagrant --password=vagrant
|
||||
|
||||
%packages --nobase --ignoremissing
|
||||
# vagrant needs this to copy initial files via scp
|
||||
openssh-clients
|
||||
sudo
|
||||
kernel-headers
|
||||
kernel-devel
|
||||
gcc
|
||||
make
|
||||
perl
|
||||
wget
|
||||
nfs-utils
|
||||
-fprintd-pam
|
||||
-intltool
|
||||
%end
|
||||
|
||||
%post
|
||||
# Force to set SELinux to a permissive mode
|
||||
sed -i -e 's/\(^SELINUX=\).*$/\1permissive/' /etc/selinux/config
|
||||
# sudo
|
||||
echo "%vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/vagrant
|
||||
%end
|
||||
@ -1,62 +0,0 @@
|
||||
{"variables": {
|
||||
"build_timestamp": "{{isotime \"20060102150405\"}}",
|
||||
"cpus": "1",
|
||||
"disk_size": "4096",
|
||||
"git_revision": "__unknown_git_revision__",
|
||||
"headless": "",
|
||||
"http_proxy": "{{env `http_proxy`}}",
|
||||
"https_proxy": "{{env `https_proxy`}}",
|
||||
"iso_checksum": "7002b56184180591a8fa08c2fe0c7338",
|
||||
"iso_checksum_type": "md5",
|
||||
"iso_name": "CentOS-7-x86_64-Minimal-1908.iso",
|
||||
"ks_path": "centos-6.8/ks.cfg",
|
||||
"memory": "512",
|
||||
"metadata": "floppy/dummy_metadata.json",
|
||||
"mirror": "http://mirrors.aliyun.com/centos",
|
||||
"mirror_directory": "7/isos/x86_64",
|
||||
"no_proxy": "{{env `no_proxy`}}",
|
||||
"template": "centos-7-x86_64",
|
||||
"version": "2.1.TIMESTAMP"
|
||||
},
|
||||
"builders":[
|
||||
{
|
||||
"type": "qemu",
|
||||
"boot_command": [
|
||||
"<tab> text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{user `ks_path`}}<enter><wait>"
|
||||
],
|
||||
"boot_wait": "10s",
|
||||
"disk_size": "{{user `disk_size`}}",
|
||||
"headless": "{{ user `headless` }}",
|
||||
"http_directory": "http",
|
||||
"iso_checksum": "{{user `iso_checksum`}}",
|
||||
"iso_checksum_type": "{{user `iso_checksum_type`}}",
|
||||
"iso_url": "{{user `mirror`}}/{{user `mirror_directory`}}/{{user `iso_name`}}",
|
||||
"output_directory": "packer-{{user `template`}}-qemu",
|
||||
"shutdown_command": "echo 'vagrant'|sudo -S /sbin/halt -h -p",
|
||||
"ssh_password": "vagrant",
|
||||
"ssh_port": 22,
|
||||
"ssh_username": "root",
|
||||
"ssh_timeout": "10000s",
|
||||
"vm_name": "{{ user `template` }}.raw",
|
||||
"net_device": "virtio-net",
|
||||
"disk_interface": "virtio",
|
||||
"format": "raw",
|
||||
"use_default_display": "false",
|
||||
"qemuargs": [
|
||||
["-display", "cocoa"]
|
||||
]
|
||||
}
|
||||
],
|
||||
"post-processors":[
|
||||
{
|
||||
"type":"ucloud-import",
|
||||
"ufile_bucket_name": "packer",
|
||||
"image_name": "packer_import",
|
||||
"image_os_type": "CentOS",
|
||||
"image_os_name": "CentOS 7.0 64位",
|
||||
"format": "raw",
|
||||
"region":"cn-bj2",
|
||||
"project_id": "org-xp2ucn"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,75 @@
|
||||
---
|
||||
description: |
|
||||
The Packer UCloud Import post-processor takes the RAW, VHD, VMDK, or qcow2 artifact from various builders and imports it to UCloud customized image list for UHost Instance.
|
||||
layout: docs
|
||||
page_title: 'UCloud Import Post-Processors'
|
||||
sidebar_current: 'docs-post-processors-ucloud-import'
|
||||
---
|
||||
|
||||
# UCloud Import Post-Processor
|
||||
|
||||
Type: `ucloud-import`
|
||||
|
||||
The Packer UCloud Import post-processor takes the RAW, VHD, VMDK, or qcow2 artifact from various builders and imports it to UCloud customized image list for UHost Instance.
|
||||
|
||||
## How Does it Work?
|
||||
|
||||
The import process operates by making a temporary copy of the RAW, VHD, VMDK, or qcow2 to an UFile bucket, and calling an import task in UHost on the RAW, VHD, VMDK, or qcow2 file. Once completed, an UCloud UHost Image is returned. The temporary RAW, VHD, VMDK, or qcow2 copy in UFile can be discarded after the import is complete.
|
||||
|
||||
## Configuration
|
||||
|
||||
There are some configuration options available for the post-processor. There
|
||||
are two categories: required and optional parameters.
|
||||
|
||||
### Required:
|
||||
|
||||
- `public_key` - (string) This is the UCloud public key. It must be provided, but it can also be sourced from the `UCLOUD_PUBLIC_KEY` environment variable.
|
||||
|
||||
- `private_key` - (string) This is the UCloud private key. It must be provided, but it can also be sourced from the `UCLOUD_PRIVATE_KEY` environment variable.
|
||||
|
||||
- `project_id` - (string) This is the UCloud project id. It must be provided, but it can also be sourced from the `UCLOUD_PROJECT_ID` environment variables.
|
||||
|
||||
- `region` - (string) This is the UCloud region. It must be provided, but it can also be sourced from the `UCLOUD_REGION` environment variables.
|
||||
|
||||
- `image_name` - (string) The name of the user-defined image, which contains 1-63 characters and only support Chinese, English, numbers, '-_,.:[]'.
|
||||
|
||||
- `ufile_bucket_name` (string) - The name of the ufile bucket where the RAW, VHD, VMDK, or qcow2 file will be copied to for import. If the Bucket isn't exist, post-process will create it for you.
|
||||
|
||||
- `image_os_type` (string) - Type of the OS. Possible values are: `CentOS`, `Ubuntu`, `Windows`, `RedHat`, `Debian`, `Other`.
|
||||
|
||||
- `image_os_name` (string) - The name of OS. Such as: `CentOS 7.2 64位`, set `Other` When `image_os_type` is `Other`.
|
||||
|
||||
- `format` (string) - The format of the import image , Possible values are: `RAW`, `VHD`, `VMDK`, or `qcow2`.
|
||||
|
||||
### Optional:
|
||||
|
||||
|
||||
- `ufile_key_name` (string) - The name of the object key in `ufile_bucket_name` where the RAW, VHD, VMDK, or qcow2 file will be copied to for import.
|
||||
|
||||
- `skip_clean` (boolean) - Whether we should skip removing the RAW or VHD file uploaded to UFile after the import process has completed. Possible values are: `true` as leave it in the UFile bucket, `false` as clean it out.(Default: `false`).
|
||||
|
||||
- `image_description` (string) - The description of the image.
|
||||
|
||||
- `wait_image_ready_timeout`(number) - Timeout of importing image. The default timeout is 3600 seconds if this option is not set or is set
|
||||
to 0.
|
||||
|
||||
## Basic Example
|
||||
|
||||
Here is a basic example. This assumes that the builder has produced a RAW artifact for us to work with. This will take the RAW image generated by a builder and upload it to UFile. Once uploaded, the import process will start, creating an UCloud UHost image to the region `cn-bj2`.
|
||||
|
||||
``` json
|
||||
"post-processors":[
|
||||
{
|
||||
"type":"ucloud-import",
|
||||
"public_key": "{{user `ucloud_public_key`}}",
|
||||
"private_key": "{{user `ucloud_private_key`}}",
|
||||
"project_id": "{{user `ucloud_project_id`}}",
|
||||
"region":"cn-bj2",
|
||||
"ufile_bucket_name": "packer-import",
|
||||
"image_name": "packer_import",
|
||||
"image_os_type": "CentOS",
|
||||
"image_os_name": "CentOS 6.10 64位",
|
||||
"format": "raw"
|
||||
}
|
||||
]
|
||||
```
|
||||
Loading…
Reference in new issue