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

32 lines
902 B
JSON

{
"variables": {
"ucloud_public_key": "{{env `UCLOUD_PUBLIC_KEY`}}",
"ucloud_private_key": "{{env `UCLOUD_PRIVATE_KEY`}}",
"ucloud_project_id": "{{env `UCLOUD_PROJECT_ID`}}",
"password": "ucloud_2019"
},
"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",
"ssh_password": "{{user `password`}}",
"ssh_username": "ubuntu",
"image_name": "packer-test-ubuntu-bj"
}],
"provisioners": [{
"type": "shell",
"execute_command": "echo '{{user `password`}}' | sudo -S '{{.Path}}'",
"inline": [
"sleep 30",
"sudo apt update",
"sudo apt install nginx -y"
]
}]
}