scripts/ansible/templates/gandi-ddns.sh.j2

14 lines
416 B
Plaintext
Raw Normal View History

2020-12-27 00:13:34 -05:00
#!/bin/bash
2020-12-31 12:48:53 -05:00
APIKEY={{ gandi_api_key }}
2020-12-27 00:13:34 -05:00
NAME=$(hostname --short)
2021-07-15 15:44:37 -04:00
IPV6=$(ip -6 addr | grep global | grep -v temporary | head -n 1 | awk '/inet6 / {gsub(/\/.*/,"",$2); print $2}')
2020-12-27 00:13:34 -05:00
curl \
--header "Authorization: Apikey $APIKEY" \
--header "Content-Type: application/json" \
--request PUT \
--data "{\"rrset_values\": [\"$IPV6\"]}" \
https://api.gandi.net/v5/livedns/domains/seaturtle.pw/records/$NAME/AAAA