sync public key back to the main server post-provision, once a new server is added sync the internal ips to all others

This commit is contained in:
2025-04-07 12:58:22 +01:00
parent e15a80163b
commit 63d506370b
4 changed files with 63 additions and 2 deletions

View File

@@ -100,7 +100,6 @@ ip link add dev wg0 type wireguard
ip address add dev wg0 192.168.2.[!internal_ip_ending!]/24
wg set wg0 listen-port 51820 private-key /root/.wg/privatekey
ip link set up dev wg0
# wg set wg0 peer <PEER_PUBLIC_KEY> allowed-ips 192.168.2.3/32 #<- this is the ip for the peer being added
# Setup Keystone Home Directory Permissions
chown -R keystone:keystone /home/keystone
@@ -167,6 +166,7 @@ APT::Periodic::AutocleanInterval "7";
APT::Periodic::Unattended-Upgrade "1";
EOF
INTERNAL_PUBLIC_KEY="$(cat /root/.wg/publickey)"
# Callback that the server is installed
curl --insecure --data "server_id=[!server_id!]" [!callback!]
curl --insecure --data "server_id=[!server_id!]&internal_public_key=$INTERNAL_PUBLIC_KEY" [!callback!]