summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2024-04-06 14:07:45 +0200
committerPatrick Spek <p.spek@tyil.nl>2024-04-06 14:07:49 +0200
commitfe8e0c3e9361a5aa8774b41d31506b96a94e78ee (patch)
tree3be832ec0ec87f901d801e4fa98cc6209bc62a88
parentec3ff9d79c2233b746cbe63c0659ba4004c3f93f (diff)
Regenerate tinc.conf on sync
-rw-r--r--defaults5
-rw-r--r--playbooks.d/vpn-tinc/playbook.bash15
2 files changed, 16 insertions, 4 deletions
diff --git a/defaults b/defaults
index 2c5d938..55fcc10 100644
--- a/defaults
+++ b/defaults
@@ -55,6 +55,11 @@ seaweedfs-filer.ip&=vpn-wireguard.ipv6
seaweedfs-master.replication=100
seaweedfs-volume.ip&=vpn-wireguard.ipv6
vpn-tinc.name=tyilnet1057
+vpn-tinc.peers.caeghi=ceaghi_tyil_net
+vpn-tinc.peers.faiwoo=faiwoo_tyil_net
+vpn-tinc.peers.gaeru=gaeru_tyil_net
+vpn-tinc.peers.qohrei=qohrei_tyil_net
+vpn-tinc.peers.ricui=ricui_tyil_net
vpn-tinc.port=657
vpn-wireguard.interface=tyilnet1058
vpn-wireguard.keepalive=10
diff --git a/playbooks.d/vpn-tinc/playbook.bash b/playbooks.d/vpn-tinc/playbook.bash
index b23371c..485c6e6 100644
--- a/playbooks.d/vpn-tinc/playbook.bash
+++ b/playbooks.d/vpn-tinc/playbook.bash
@@ -43,10 +43,6 @@ playbook_add()
"$etc" \
"$etc/hosts"
- file_template tinc.conf \
- "name=$host" \
- > "$etc/tinc.conf"
-
file_template "tinc-up-$iptool" \
"ip4=$ipv4" \
"ip6=$ipv6" \
@@ -142,6 +138,17 @@ playbook_sync()
cp -v -- "$data/hosts/$file" "$etc/hosts/$file"
done
+ info "$BASHTARD_PLAYBOOK/sync" "Reconfiguring peers"
+ {
+ printf "Name = %s\n\n" "$host"
+
+ while read -r peer
+ do
+ printf "ConnectTo = %s\n" "$(config "$BASHTARD_PLAYBOOK.peers.$peer")"
+ done < <( config_subkeys "$BASHTARD_PLAYBOOK.peers" )
+ } > "$etc/tinc.conf"
+
+
[[ "$BASHTARD_COMMAND" == "add" ]] && return
[[ "$hash" == "$(dir_hash "$etc/hosts")" ]] && return