Skip to content

Instantly share code, notes, and snippets.

@symm
Created May 1, 2015 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save symm/195a1718c5fc3cbd86b4 to your computer and use it in GitHub Desktop.
Save symm/195a1718c5fc3cbd86b4 to your computer and use it in GitHub Desktop.
PatchDNS.sh
#!/bin/bash
POWERDNS_API_KEY="XXX"
POWERDNS_API_URL="http://x.x.x.x:8081"
POWERDNS_ZONE="example.com"
DNS_NAME="foo.example.com"
DNS_TTL="120"
SERVICE_IP="1.2.3.4"
curl --silent -X PATCH --data '{"rrsets":[{"name":"'$DNS_NAME'","type":"A","changetype":"REPLACE","records":[{"name":"'$DNS_NAME'","type":"A","content":"'$SERVICE_IP'","ttl":'$DNS_TTL',"priority":0,"disabled":false}]}]}' -H 'X-API-Key: '$POWERDNS_API_KEY'' $POWERDNS_API_URL/servers/localhost/zones/$POWERDNS_ZONE > /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment