From d08265517be752148f1d58e62dcdb58270483636 Mon Sep 17 00:00:00 2001 From: Dryusdan Date: Thu, 23 Apr 2020 15:17:29 +0200 Subject: [PATCH] Add know_host removing --- deletehost.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deletehost.sh b/deletehost.sh index 3b9faf1..e06fd97 100755 --- a/deletehost.sh +++ b/deletehost.sh @@ -70,6 +70,9 @@ info "Remove host from Prometheus" sudo rm -f "/etc/prometheus/nodes/*${VMNAME}*" sudo systemctl restart prometheus +info "Remove from know_host" +ssh-keygen -R "${VMNAME}" + info "Remove host from Rudder" RUDDER_ID=$(curl -s -X GET -H 'Content-Type: application/json' -H "X-API-Token: ${RUDDER_API_TOKEN}" -H "X-API-Version: 12" "${RUDDER_SRV}/rudder/api/nodes" | jq --raw-output '.data.nodes[] | select(.hostname=="'${VMNAME}'") | .id') curl -s -X DELETE -H 'Content-Type: application/json' -H "X-API-Token: ${RUDDER_API_TOKEN}" -H "X-API-Version: 12" "${RUDDER_SRV}/rudder/api/nodes/${RUDDER_ID}" &> /dev/null