From ce761bdcb4a6cd3d39cf907f6ff2f20e153a6099 Mon Sep 17 00:00:00 2001 From: "mingsheng.su" Date: Fri, 28 Jun 2019 18:14:00 +0800 Subject: [PATCH] Update example of ucloud-uhost --- examples/ucloud/ubuntu.json | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/ucloud/ubuntu.json b/examples/ucloud/ubuntu.json index 59a085b23..baed4fa15 100644 --- a/examples/ucloud/ubuntu.json +++ b/examples/ucloud/ubuntu.json @@ -2,7 +2,8 @@ "variables": { "ucloud_public_key": "{{env `UCLOUD_PUBLIC_KEY`}}", "ucloud_private_key": "{{env `UCLOUD_PRIVATE_KEY`}}", - "ucloud_project_id": "{{env `UCLOUD_PROJECT_ID`}}" + "ucloud_project_id": "{{env `UCLOUD_PROJECT_ID`}}", + "password": "ucloud_2019" }, "builders": [{ @@ -14,16 +15,17 @@ "availability_zone": "cn-bj2-02", "instance_type": "n-basic-2", "source_image_id": "uimage-irofn4", - "ssh_password": "ucloud_2019", + "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", - "echo 'ucloud_2019' | sudo -S apt update", + "sudo apt update", "sudo apt install nginx -y" ] }]