From fe8e0c3e9361a5aa8774b41d31506b96a94e78ee Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Sat, 6 Apr 2024 14:07:45 +0200 Subject: Regenerate tinc.conf on sync --- playbooks.d/vpn-tinc/playbook.bash | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'playbooks.d') 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 -- cgit v1.1