|
@@ -1,12 +1,13 @@
|
|
|
#!/bin/bash
|
|
|
|
|
|
SRV="${1:?Need a fqdn}"
|
|
|
-SSHKEY_NAME="lfwdbot"
|
|
|
-#HTTP_PAYLOAD='{ "doNotSendPassword": false, "language": "fr", "publicSshKey": "", "softwareId": [0], "sshKey": [ "'${SSHKEY_NAME}'" ], "templateId": 0 }'
|
|
|
+SSHKEY_NAME="${2:-vpsbot}"
|
|
|
|
|
|
sshpubkey=$( ./getSSHKeys "${SSHKEY_NAME}" | jq -r '.key' )
|
|
|
-image_id=$( ./getImageDetails "${SRV}" | jq -r '.id' )
|
|
|
-HTTP_PAYLOAD='{ "doNotSendPassword": true, "publicSshKey": "'${sshpubkey}'", "imageId": "'${image_id}'" }'
|
|
|
+current_image_id=$( ./getImageDetails "${SRV}" | jq -r '.id' )
|
|
|
+
|
|
|
+IMAGE_ID="${3:-${current_image_id}}"
|
|
|
+HTTP_PAYLOAD='{ "doNotSendPassword": true, "publicSshKey": "'${sshpubkey}'", "imageId": "'${IMAGE_ID}'" }'
|
|
|
|
|
|
./ovh-bash post "vps/${SRV}/rebuild" "${HTTP_PAYLOAD}"
|
|
|
|