Name: packer-provider
Owner: Alibaba
Description: null
Created: 2017-01-16 08:41:23.0
Updated: 2018-05-04 07:03:59.0
Pushed: 2017-11-28 02:38:40.0
Homepage: null
Size: 97
Language: Go
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
This is the official repository for the Alicloud packer provider.
Currently it supports packer version ? v0.12.1.
If you are not planning to contribute to this repo, you can download the compiled binaries according to you platform, unzip and move them into the folder under the packer PATH such as /usr/local/packer.
export ALICLOUD_ACCESS_KEY="access key value"
export ALICLOUD_SECRET_KEY="secret key value"
$GOPATH>
r -p src/github.com/alibaba/
$GOPATH>/src/github.com/alibaba/
clone https://github.com/alibaba/packer-provider
$GOPTH>/src/github.com/alibaba/packer-provider
all
e ~/.bashrc
er build example/alicloud.json
If output similar as following, configurations, you can now start the journey of alicloud with packer supportloud output will be in this color.
alicloud: Force delete flag found, skipping prevalidating Alicloud ECS Image Name
alicloud: Found Image ID: centos7u2_64_40G_cloudinit_20160728.raw
alicloud: allocated eip address 121.196.193.14
alicloud: Instance starting
alicloud: Waiting for SSH to become available...
alicloud: This machine's host=121.196.193.14
alicloud: This machine's host=121.196.193.14
alicloud: This machine's host=121.196.193.14
alicloud: Connected to SSH!
alicloud: Provisioning with shell script: /var/folders/3q/w38xx_js6cl6k5mwkrqsnw7w0000gn/T/packer-shell170579778
iables": {
ess_key": "{{env `ALICLOUD_ACCESS_KEY`}}",
ret_key": "{{env `ALICLOUD_SECRET_KEY`}}"
lders": [{
e":"alicloud-ecs",
ess_key":"{{user `access_key`}}",
ret_key":"{{user `secret_key`}}",
ion":"cn-beijing",
ge_name":"packer_test2",
rce_image":"centos_7_2_64_40G_base_20170222.vhd",
_username":"root",
tance_type":"ecs.n1.tiny",
optimized":"true",
ernet_charge_type":"PayByTraffic",
ge_force_delete":"true"
visioners": [{
e": "shell",
ine": [
leep 30",
um install redis.x86_64 -y"
Create a simple image for windows
{ “variables”: {
"access_key": "{{env `ALICLOUD_ACCESS_KEY`}}",
"secret_key": "{{env `ALICLOUD_SECRET_KEY`}}"
}, “builders”: [{
"type":"alicloud-ecs",
"access_key":"{{user `access_key`}}",
"secret_key":"{{user `secret_key`}}",
"region":"cn-beijing",
"image_name":"packer_test",
"source_image":"win2008_64_ent_r2_zh-cn_40G_alibase_20170118.vhd",
"instance_type":"ecs.n1.tiny",
"internet_charge_type":"PayByTraffic",
"io_optimized":"true",
"image_force_delete":"true",
"communicator": "winrm",
"winrm_port": 5985,
"winrm_username": "Administrator",
"winrm_password": "Test1234"
}], “provisioners”: [{
"type": "powershell",
"inline": ["dir c:\\"]
}] }
Create a simple image with redis installed and mounted disk
{ “variables”: {
"access_key": "{{env `ALICLOUD_ACCESS_KEY`}}",
"secret_key": "{{env `ALICLOUD_SECRET_KEY`}}"
}, “builders”: [{
"type":"alicloud-ecs",
"access_key":"{{user `access_key`}}",
"secret_key":"{{user `secret_key`}}",
"region":"cn-beijing",
"image_name":"packer_with_data_disk",
"source_image":"centos_7_2_64_40G_base_20170222.vhd",
"ssh_username":"root",
"instance_type":"ecs.n1.tiny",
"internet_charge_type":"PayByTraffic",
"io_optimized":"true",
"image_disk_mappings":[{"disk_name":"data1","disk_size":20},{"disk_name":"data1","disk_size":20,"disk_device":"/dev/xvdz"}]
}], “provisioners”: [{
"type": "shell",
"inline": [
"sleep 30",
"yum install redis.x86_64 -y"
]
}] }
Here are [more examples](https://github.com/alibaba/packer-provider/tree/master/examples/alicloud) include chef, jenkins image template etc.
How to contribute code
you are not sure or have any doubts, feel free to ask and/or submit an issue or PR. We appreciate all contributions and don't want to create artificial obstacles that get in the way.
ntributions are welcome and will be merged via PRs.
Contributors
uzhih2017
License
is project is licensed under the Apache License, Version 2.0. See [LICENSE](https://github.com/alibaba/packer-provider/blob/master/LICENSE) for the full license text.
Refrence
kcer document: https://www.packer.io/intro/