diff options
author | Hugo Hörnquist <hugo@hornquist.se> | 2021-11-04 18:33:21 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@hornquist.se> | 2021-11-04 18:33:21 +0100 |
commit | 510a3014391d056a26555a5be1320c3f1b94f796 (patch) | |
tree | 78076aae7c0e6b80b5d02b897bfcc6e28c2cc650 /modules/nsupdate/templates | |
parent | Ensure certbot is installed on hornquist.se. (diff) | |
download | webdav_server-510a3014391d056a26555a5be1320c3f1b94f796.tar.gz webdav_server-510a3014391d056a26555a5be1320c3f1b94f796.tar.xz |
Set up nsupdate.
Diffstat (limited to 'modules/nsupdate/templates')
-rw-r--r-- | modules/nsupdate/templates/nsupdate.epp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/modules/nsupdate/templates/nsupdate.epp b/modules/nsupdate/templates/nsupdate.epp new file mode 100644 index 0000000..66fe4b2 --- /dev/null +++ b/modules/nsupdate/templates/nsupdate.epp @@ -0,0 +1,18 @@ +<%- | + String $iface, + String $nameserver, + String $keyname, + Array[DNSRecord] $records, +| -%> +#!/bin/bash + +IP=$(ip -j a show dev <%= $iface %> | jq --raw-output '.[0].addr_info[] | select(.family == "inet").local') + +nsupdate "$@" -k '/var/lib/nsupdate/<%= $keyname %>.key' << EOF +server <%= $nameserver %> +<%- $records.each |$record| { -%> +update delete <%= $record['domain'] %> <%= $record['type'] %> +update add <%= $record['domain'] %> <%= $record['ttl'] %> <%= $record['type'] %> ${IP} +<%- } -%> +send +EOF |