summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2024-03-04 10:26:05 +0000
committerPatrick Spek <p.spek@tyil.nl>2024-03-04 11:53:21 +0100
commit2d7f591ec903a658cf92fa08437d875d0dc55a30 (patch)
treebfb8a4d3ef40b3864a341c142f643729ae8b2ccb
parentf5d4648757abf4aebfe676de2d5dc15bbf3db364 (diff)
Slightly alter the order of operations
-rw-r--r--playbooks.d/vpn-tinc/playbook.bash21
1 files 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"