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

14 lines
416 B
Django/Jinja

#!/bin/bash
APIKEY={{ gandi_api_key }}
NAME=$(hostname --short)
IPV6=$(ip -6 addr | grep global | grep -v temporary | head -n 1 | awk '/inet6 / {gsub(/\/.*/,"",$2); print $2}')
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