From 2d7f591ec903a658cf92fa08437d875d0dc55a30 Mon Sep 17 00:00:00 2001
From: Patrick Spek
Date: Mon, 4 Mar 2024 10:26:05 +0000
Subject: Slightly alter the order of operations
---
playbooks.d/vpn-tinc/playbook.bash | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/playbooks.d/vpn-tinc/playbook.bash b/playbooks.d/vpn-tinc/playbook.bash
index 909dc8f..c163949 100644
--- a/playbooks.d/vpn-tinc/playbook.bash
+++ b/playbooks.d/vpn-tinc/playbook.bash
@@ -30,10 +30,9 @@ playbook_add()
"$etc" \
"$etc/hosts"
-
- chmod +x \
- "$etc/tinc-up" \
- "$etc/tinc-down"
+ file_template tinc.conf \
+ "name=$host" \
+ > "$etc/tinc.conf"
info "$BASHTARD_PLAYBOOK/add" "Generating private keys"
@@ -48,15 +47,13 @@ playbook_add()
esac
info "$BASHTARD_PLAYBOOK/add" "Adding new host to Bashtard configs"
-
mkdir -pv -- "$data/hosts"
-
- playbook_sync
-
cp -v -- \
"$etc/hosts/$host" \
"$data/hosts/$host"
+ playbook_sync
+
info "$BASHTARD_PLAYBOOK" "Enabling VPN service"
case "${BASHTARD_PLATFORM[key]}" in
@@ -109,10 +106,6 @@ playbook_sync()
*) iptool=ip
esac
- file_template tinc.conf \
- "name=$host" \
- > "$etc/tinc.conf"
-
file_template "tinc-up-$iptool" \
"ip4=$ipv4" \
"ip6=$ipv6" \
@@ -128,6 +121,10 @@ playbook_sync()
"ip6=$ipv6" \
> "$etc/hosts/$host"
+ chmod +x \
+ "$etc/tinc-up" \
+ "$etc/tinc-down"
+
info "$BASHTARD_PLAYBOOK" "Regenerating tinc hosts"
rm -fr -- "$etc/hosts"
mkdir -p -- "$etc/hosts"
--
cgit v1.1