diff options
author | Patrick Spek <p.spek@tyil.nl> | 2024-04-06 14:07:45 +0200 |
---|---|---|
committer | Patrick Spek <p.spek@tyil.nl> | 2024-04-06 14:07:49 +0200 |
commit | fe8e0c3e9361a5aa8774b41d31506b96a94e78ee (patch) | |
tree | 3be832ec0ec87f901d801e4fa98cc6209bc62a88 /playbooks.d | |
parent | ec3ff9d79c2233b746cbe63c0659ba4004c3f93f (diff) |
Regenerate tinc.conf on sync
Diffstat (limited to 'playbooks.d')
-rw-r--r-- | playbooks.d/vpn-tinc/playbook.bash | 15 |
1 files changed, 11 insertions, 4 deletions
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 |