30 lines
533 B
Bash
Executable File
30 lines
533 B
Bash
Executable File
#!/bin/bash
|
|
|
|
readonly f=/etc/hcloud-metadata.json
|
|
|
|
cat <<EOF
|
|
[Match]
|
|
MACAddress=$(jq -r '.network.mac_address' "$f")
|
|
|
|
[Network]
|
|
Address=$(jq -r '.network.ipv6_address' "$f")/64
|
|
Gateway=$(jq -r '.network.ipv4_gateway' "$f")
|
|
Gateway=$(jq -r '.network.ipv6_gateway' "$f")
|
|
|
|
NTP=ntp1.hetzner.de
|
|
NTP=ntp2.hetzner.com
|
|
NTP=ntp3.hetzner.net
|
|
|
|
EOF
|
|
|
|
for nameserver in $(jq -r '.network.nameservers|join(" ")' "$f"); do
|
|
echo "DNS=${nameserver}"
|
|
done
|
|
|
|
cat <<EOF
|
|
|
|
[Address]
|
|
Address=$(jq -r '.network.ipv4_address' "$f")/32
|
|
Peer=172.31.1.1/32
|
|
EOF
|