Add know_host removing

This commit is contained in:
Dryusdan 2020-04-23 15:17:29 +02:00
parent 72a80f83f7
commit d08265517b
1 changed files with 3 additions and 0 deletions

View File

@ -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