-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from kingsoftcloud/trunk
Trunk
- Loading branch information
Showing
30 changed files
with
1,493 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
--- | ||
description: > | ||
The ksyun-epc Packer builder is able to create Ksyun Images backed by | ||
bare metal instance storage as the root device. | ||
page_title: Ksyun EPC - Builders | ||
nav_title: Epc | ||
--- | ||
|
||
# Ksyun Image Builder (epc) | ||
|
||
Type: `ksyun-epc` | ||
|
||
The `ksyun-epc` Packer builder is able to create Ksyun Images backed by | ||
bare metal instance storage as the root device. | ||
|
||
|
||
## Configuration Reference | ||
|
||
There are many configuration options available for the builder. In addition to | ||
the items listed here, you will want to look at the general configuration | ||
references for [Image](#image-configuration), | ||
[Access](#access-configuration), | ||
[Run](#run-configuration) and | ||
[General](#general-configuration) | ||
configuration references, which are | ||
necessary for this build to succeed and can be found further down the page. | ||
|
||
## Run Configuration | ||
### Required: | ||
|
||
@include 'builder/epc/KsyunEpcRunConfig-required.mdx' | ||
|
||
### Optional: | ||
|
||
@include 'builder/epc/KsyunEpcRunConfig-not-required.mdx' | ||
|
||
## Access Configuration | ||
|
||
### Required: | ||
|
||
@include 'builder/AccessConfig-required.mdx' | ||
|
||
## General Configuration | ||
|
||
### Optional: | ||
|
||
@include 'builder/CommonConfig-not-required.mdx' | ||
|
||
## Image Configuration | ||
|
||
### Optional: | ||
|
||
@include 'builder/epc/KsyunImageConfig-not-required.mdx' | ||
|
||
## Basic Example | ||
|
||
Here is a basic example. It is completely valid but excludes the access keys: | ||
|
||
### Example Usage | ||
|
||
```json | ||
{ | ||
"variables": { | ||
"access_key": "{{ env `KSYUN_ACCESS_KEY` }}", | ||
"secret_key": "{{ env `KSYUN_SECRET_KEY` }}" | ||
}, | ||
"builders": [{ | ||
"type":"ksyun-epc", | ||
"access_key":"{{user `access_key`}}", | ||
"secret_key":"{{user `secret_key`}}", | ||
"region":"cn-beijing-6", | ||
"source_image_id":"eb8c0428-476e-49af-8ccb-9fad2455a54c", | ||
"host_type":"EC-I-III-II", | ||
"availability_zone":"cn-beijing-6c", | ||
"raid": "Raid1", | ||
"ssh_username":"root", | ||
"ssh_clear_authorized_keys": true, | ||
"associate_public_ip_address": true | ||
}], | ||
"provisioners": [{ | ||
"type": "shell", | ||
"inline": [ | ||
"sleep 30", | ||
"yum install mysql -y" | ||
] | ||
}] | ||
} | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
--- | ||
description: > | ||
The ksyun-kec Packer builder is able to create Ksyun Images backed by | ||
instance storage as the root device. | ||
page_title: Ksyun Instance(KEC) - Builders | ||
nav_title: Instance(KEC) | ||
--- | ||
|
||
# Ksyun Image Builder (kec) | ||
|
||
Type: `ksyun-kec` | ||
|
||
The `ksyun-kec` Packer builder is able to create Ksyun Images backed by | ||
instance storage as the root device. | ||
|
||
|
||
## Configuration Reference | ||
|
||
There are many configuration options available for the builder. In addition to | ||
the items listed here, you will want to look at the general configuration | ||
references for [Image](#image-configuration), | ||
[Access](#access-configuration), | ||
[Run](#run-configuration) and | ||
[General](#general-configuration) | ||
configuration references, which are | ||
necessary for this build to succeed and can be found further down the page. | ||
|
||
## Run Configuration | ||
|
||
### Required: | ||
|
||
@include 'builder/kec/KsyunKecRunConfig-required.mdx' | ||
|
||
### Optional: | ||
|
||
@include 'builder/kec/KsyunKecRunConfig-not-required.mdx' | ||
|
||
## Access Configuration | ||
|
||
### Required: | ||
|
||
@include 'builder/AccessConfig-required.mdx' | ||
|
||
## General Configuration | ||
|
||
### Optional: | ||
|
||
@include 'builder/CommonConfig-not-required.mdx' | ||
|
||
## Image Configuration | ||
|
||
### Required: | ||
|
||
@include 'builder/kec/KsyunImageConfig-required.mdx' | ||
|
||
### Optional: | ||
|
||
@include 'builder/kec/KsyunImageConfig-not-required.mdx' | ||
|
||
### Source Image Filter Configuration | ||
|
||
@include 'builder/KmiFilterOptions-not-required.mdx' | ||
|
||
## Basic Example | ||
|
||
Here is a basic example. It is completely valid but excludes the access keys: | ||
|
||
### Example Usage | ||
|
||
```hcl | ||
packer { | ||
required_plugins { | ||
ksyun = { | ||
version = ">=0.1.0" | ||
source = "github.com/kingsoftcloud/ksyun" | ||
} | ||
} | ||
} | ||
variable ak { | ||
type = string | ||
default = "${env("KSYUN_ACCESS_KEY")}" | ||
} | ||
variable sk { | ||
type = string | ||
default = "${env("KSYUN_SECRET_KEY")}" | ||
} | ||
source "ksyun-kec" "test" { | ||
access_key = var.ak | ||
secret_key = var.sk | ||
region = "cn-shanghai-2" | ||
image_name = "packer_test" | ||
source_image_id = "IMG-05f198b3-9df6-4f94-a3e3-dcee4b48c4aa" | ||
instance_type = "N3.1B" | ||
ssh_username = "root" | ||
# 此参数用于跳过ssh | ||
# communicator = "none" | ||
# 如需使用ssh,须保证网络能通,如果不在同一个网络环境下就要挂公网ip | ||
associate_public_ip_address = true | ||
ssh_clear_authorized_keys = true | ||
# 此参数为true时,data_disks的硬盘不会打快照加入镜像 | ||
image_ignore_data_disks = true | ||
data_disks { | ||
data_disk_type = "SSD3.0" | ||
data_disk_size = 50 | ||
} | ||
# 复制镜像到以下region | ||
image_copy_regions = ["cn-beijing-6", "cn-guangzhou-1"] | ||
# 镜像复制后的名称, 不命名则使用原镜像的名称 | ||
image_copy_names = ["copy-test"] | ||
# 开启镜像预热 | ||
image_warm_up = true | ||
# 镜像共享给其他用户 | ||
# image_share_accounts = ["xxxxxxxx", "xxxxxxxx"] | ||
} | ||
build { | ||
sources = ["source.ksyun-kec.test"] | ||
provisioner "shell" { | ||
inline = ["sleep 10", "df -h"] | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
--- | ||
description: > | ||
The Ksyun KMI data source provides information from a KMI that will be fetched based | ||
on the filter options provided in the configuration. | ||
page_title: Ksyun KMI - Data Source | ||
nav_title: Ksyun KMI | ||
--- | ||
|
||
# Ksyun KMI Data Source | ||
|
||
Type: `ksyun-kmi` | ||
|
||
The Ksyun KMI data source will filter and fetch a Ksyun Images, and output all the Ksyun Machine images information that will | ||
be then available to use in the [Ksyun builders](./). | ||
|
||
-> **Note:** Data sources is a feature exclusively available to HCL2 templates. | ||
|
||
Basic example of usage: | ||
|
||
```hcl | ||
data "ksyun-kmi" "foo" { | ||
access_key = "ksyun access key" | ||
secret_key = "ksyun secret key" | ||
region = "cn-shanghai-2" | ||
platform = "centos-7.5" | ||
name_regex = "centos-7.5.*" | ||
image_source = "system" // import, copy, share, extend, system. | ||
most_recent = true | ||
} | ||
``` | ||
This selects the most recent Centos 7.5 Ksyun Images from remote Ksyun. Note that the data source will fail unless | ||
*exactly* one AMI is returned. In the above example, `most_recent` will cause this to succeed by selecting the newest image. | ||
|
||
## Configuration Reference | ||
|
||
### Required: | ||
|
||
@include 'builder/AccessConfig-required.mdx' | ||
|
||
### Optional: | ||
|
||
@include 'builder/KmiFilterOptions-not-required.mdx' | ||
|
||
## Output Data | ||
|
||
@include 'datasource/kmi/DatasourceOutput.mdx' | ||
|
||
## Basic Example | ||
|
||
Here is a basic example. It is completely valid but excludes the access keys: | ||
|
||
### Example Usage | ||
|
||
```hcl | ||
packer { | ||
required_plugins { | ||
ksyun = { | ||
version = ">=0.1.0" | ||
source = "github.com/kingsoftcloud/ksyun" | ||
} | ||
} | ||
} | ||
variable ak { | ||
type = string | ||
default = "${env("KSYUN_ACCESS_KEY")}" | ||
} | ||
variable sk { | ||
type = string | ||
default = "${env("KSYUN_SECRET_KEY")}" | ||
} | ||
data "ksyun-kmi" "foo" { | ||
access_key = var.ak | ||
secret_key = var.sk | ||
region = "cn-shanghai-2" | ||
platform = "centos-7.5" | ||
name_regex = "centos-7.5.*" | ||
image_source = "system" // import, copy, share, extend, system. | ||
most_recent = true | ||
} | ||
source "ksyun-kec" "test" { | ||
access_key = var.ak | ||
secret_key = var.sk | ||
region = "cn-shanghai-2" | ||
image_name = "packer_test" | ||
source_image_id = data.ksyun-kmi.foo.id | ||
instance_type = "N3.1B" | ||
ssh_username = "root" | ||
} | ||
build { | ||
sources = ["source.ksyun-kec.test"] | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.