packer-cn/builder/ucloud/examples/ubuntu.json

32 lines
902 B
JSON
Raw Normal View History

2019-06-27 02:10:26 -04:00
{
2019-06-27 02:28:46 -04:00
"variables": {
"ucloud_public_key": "{{env `UCLOUD_PUBLIC_KEY`}}",
"ucloud_private_key": "{{env `UCLOUD_PRIVATE_KEY`}}",
2019-06-28 06:14:00 -04:00
"ucloud_project_id": "{{env `UCLOUD_PROJECT_ID`}}",
"password": "ucloud_2019"
2019-06-27 02:28:46 -04:00
},
2019-06-27 02:10:26 -04:00
2019-06-27 02:28:46 -04:00
"builders": [{
"type": "ucloud-uhost",
"public_key": "{{user `ucloud_public_key`}}",
"private_key": "{{user `ucloud_private_key`}}",
"project_id": "{{user `ucloud_project_id`}}",
"region": "cn-bj2",
"availability_zone": "cn-bj2-02",
"instance_type": "n-basic-2",
"source_image_id": "uimage-irofn4",
2019-06-28 06:14:00 -04:00
"ssh_password": "{{user `password`}}",
2019-06-27 02:28:46 -04:00
"ssh_username": "ubuntu",
"image_name": "packer-test-ubuntu-bj"
}],
2019-06-27 02:10:26 -04:00
2019-06-27 02:28:46 -04:00
"provisioners": [{
"type": "shell",
2019-06-28 06:14:00 -04:00
"execute_command": "echo '{{user `password`}}' | sudo -S '{{.Path}}'",
2019-06-27 02:28:46 -04:00
"inline": [
"sleep 30",
2019-06-28 06:14:00 -04:00
"sudo apt update",
2019-06-27 02:28:46 -04:00
"sudo apt install nginx -y"
]
}]
2019-06-27 02:10:26 -04:00
}