Browse Source

Add know_host removing

master
Dryusdan 2 years ago
parent
commit
d08265517b
  1. 3
      deletehost.sh

3
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

Loading…
Cancel
Save