Skip to content

Commit

Permalink
Move iptables rules to another file
Browse files Browse the repository at this point in the history
  • Loading branch information
Naman1997 committed Sep 7, 2024
1 parent 12075a3 commit 7c9923c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 17 deletions.
6 changes: 4 additions & 2 deletions ansible/3-wireguard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,18 @@
shell: "mkdir -p /etc/wireguard/helper"
- name: Generate helper script - 1
template:
src: "../templates/wireguard/add-nat-routing.sh"
src: "../templates/iptables/add-nat-routing.sh"
dest: "/etc/wireguard/helper/add-nat-routing.sh"
vars:
interface: "{{ gateway_internet_interface.stdout }}"
- name: Generate helper script - 2
template:
src: "../templates/wireguard/remove-nat-routing.sh"
src: "../templates/iptables/remove-nat-routing.sh"
dest: "/etc/wireguard/helper/remove-nat-routing.sh"
vars:
interface: "{{ gateway_internet_interface.stdout }}"
- name: Make helper scripts executable
shell: "chmod +x /etc/wireguard/helper/add-nat-routing.sh && chmod +x /etc/wireguard/helper/remove-nat-routing.sh"
- name: Get public key of gateway
slurp:
src: /etc/wireguard/publickey_gateway
Expand Down
4 changes: 2 additions & 2 deletions ansible_hosts.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[proxy]
proxy ansible_host=${proxy_ip} ansible_user=${proxy_user} ansible_ssh_private_key_file=${proxy_key}
proxy ansible_host={proxy_ip} ansible_user={proxy_user} ansible_ssh_private_key_file={proxy_key}

[gateway]
gateway ansible_host=${gateway_ip} ansible_user=${gateway_user} ansible_ssh_private_key_file=${gateway_key}
gateway ansible_host={gateway_ip} ansible_user={gateway_user} ansible_ssh_private_key_file={gateway_key}
26 changes: 13 additions & 13 deletions scripts/wireguard.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
#!/bin/bash

# Setup DuckDNS
ansible-playbook -v ansible/1-duckdns.yml -i ansible_hosts -e "@ansible/ansible_vars"
DUCKDNS_SETUP=$?
if [ $DUCKDNS_SETUP -ne 0 ]; then
echo "Unable to create docker container for duckdns. Make sure docker is installed on the VPS."
exit 1
fi
# ansible-playbook -v ansible/1-duckdns.yml -i ansible_hosts -e "@ansible/ansible_vars"
# DUCKDNS_SETUP=$?
# if [ $DUCKDNS_SETUP -ne 0 ]; then
# echo "Unable to create docker container for duckdns. Make sure docker is installed on the VPS."
# exit 1
# fi

# Setup unattended upgrades
ansible-playbook -v ansible/2-unattended-upgrades.yml -i ansible_hosts
UPGRADES_SETUP=$?
if [ $UPGRADES_SETUP -ne 0 ]; then
echo "Unable to setup unattended upgrades. Make sure to use ubuntu/debian on both VMs."
exit 1
fi
# # Setup unattended upgrades
# ansible-playbook -v ansible/2-unattended-upgrades.yml -i ansible_hosts
# UPGRADES_SETUP=$?
# if [ $UPGRADES_SETUP -ne 0 ]; then
# echo "Unable to setup unattended upgrades. Make sure to use ubuntu/debian on both VMs."
# exit 1
# fi

# Setup wireguard
ansible-playbook -v ansible/3-wireguard.yml -i ansible_hosts -e "@ansible/ansible_vars"
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 7c9923c

Please sign in to comment.