3
0

vpsReinstall 395 B

1234567891011121314
  1. #!/bin/bash
  2. SRV="${1:?Need a fqdn}"
  3. SSHKEY_NAME="${2:-vpsbot}"
  4. sshpubkey=$( ./getSSHKeys "${SSHKEY_NAME}" | jq -r '.key' )
  5. current_image_id=$( ./getImageDetails "${SRV}" | jq -r '.id' )
  6. IMAGE_ID="${3:-${current_image_id}}"
  7. HTTP_PAYLOAD='{ "doNotSendPassword": true, "publicSshKey": "'${sshpubkey}'", "imageId": "'${IMAGE_ID}'" }'
  8. ./ovhcli post "vps/${SRV}/rebuild" "${HTTP_PAYLOAD}"
  9. exit $?