mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 15:06:26 +02:00
Optimized wireguard roles
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# server_native-wireguard-behind-nat
|
||||
# client-wireguard-behind-nat
|
||||
|
||||
# see
|
||||
- https://gist.github.com/insdavm/b1034635ab23b8839bf957aa406b5e39
|
@@ -0,0 +1,2 @@
|
||||
dependencies:
|
||||
- client_application-wireguard
|
6
roles/client_application-wireguard/handlers/main.yml
Normal file
6
roles/client_application-wireguard/handlers/main.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
- name: "restart set-mtu.service"
|
||||
systemd:
|
||||
name: set-mtu.service
|
||||
state: restarted
|
||||
enabled: yes
|
||||
daemon_reload: yes
|
2
roles/client_application-wireguard/meta/main.yml
Normal file
2
roles/client_application-wireguard/meta/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
dependencies:
|
||||
- independent-application-wireguard
|
11
roles/client_application-wireguard/tasks/main.yml
Normal file
11
roles/client_application-wireguard/tasks/main.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
- name: create set-mtu.service
|
||||
copy:
|
||||
src: set-mtu.service
|
||||
dest: /etc/systemd/system/set-mtu.service
|
||||
notify: restart set-mtu.service
|
||||
|
||||
- name: create set-mtu.sh
|
||||
template:
|
||||
src: set-mtu.sh.j2
|
||||
dest: /usr/local/bin/set-mtu.sh
|
||||
notify: restart set-mtu.service
|
@@ -4,3 +4,6 @@
|
||||
state: restarted
|
||||
enabled: yes
|
||||
daemon_reload: yes
|
||||
|
||||
- name: "reload sysctl configuration"
|
||||
shell: "sysctl --load='/etc/sysctl.d/wireguard-ip.conf'"
|
@@ -1,21 +1,27 @@
|
||||
- name: install wireguard for Arch
|
||||
pacman: name=wireguard-tools state=present
|
||||
pacman:
|
||||
name: wireguard-tools
|
||||
state: present
|
||||
when: ansible_os_family == "Archlinux"
|
||||
|
||||
- name: install wireguard for Ubuntu
|
||||
apt: name=wireguard state=present
|
||||
apt:
|
||||
name: wireguard
|
||||
state: present
|
||||
when: ansible_os_family == "Debian"
|
||||
|
||||
- name: create wireguard-ip.conf
|
||||
copy:
|
||||
src: "wireguard-ip.conf"
|
||||
dest: /etc/sysctl.d/wireguard-ip.conf
|
||||
owner: root
|
||||
group: root
|
||||
notify: reload sysctl configuration
|
||||
|
||||
- name: create /etc/wireguard/wg0.conf
|
||||
copy:
|
||||
src: "{{ inventory_dir }}/files/{{ inventory_hostname }}/etc/wireguard/wg0.conf"
|
||||
dest: /etc/wireguard/wg0.conf
|
||||
owner: root
|
||||
group: root
|
||||
notify: restart wireguard
|
||||
|
||||
- name: enable ipv4-forwarding
|
||||
shell: sysctl net.ipv4.ip_forward=1
|
||||
|
||||
- name: enable ipv6-forwarding
|
||||
shell: sysctl net.ipv6.conf.all.forwarding=1
|
||||
notify: restart wireguard
|
@@ -1,16 +0,0 @@
|
||||
- name: "restart set-mtu.service"
|
||||
systemd:
|
||||
name: set-mtu.service
|
||||
state: restarted
|
||||
enabled: yes
|
||||
daemon_reload: yes
|
||||
|
||||
- name: "restart wireguard"
|
||||
systemd:
|
||||
name: wg-quick@wg0.service
|
||||
state: restarted
|
||||
enabled: yes
|
||||
daemon_reload: yes
|
||||
|
||||
- name: "reload sysctl configuration"
|
||||
shell: "sysctl -p"
|
@@ -1,32 +0,0 @@
|
||||
- name: install wireguard
|
||||
pacman:
|
||||
name: wireguard-tools
|
||||
state: present
|
||||
|
||||
- name: create set-mtu.service
|
||||
copy:
|
||||
src: set-mtu.service
|
||||
dest: /etc/systemd/system/set-mtu.service
|
||||
notify: restart set-mtu.service
|
||||
|
||||
- name: create set-mtu.sh
|
||||
template:
|
||||
src: set-mtu.sh.j2
|
||||
dest: /usr/local/bin/set-mtu.sh
|
||||
notify: restart set-mtu.service
|
||||
|
||||
- name: create wireguard-ip.conf
|
||||
copy:
|
||||
src: "wireguard-ip.conf"
|
||||
dest: /etc/sysctl.d/wireguard-ip.conf
|
||||
owner: root
|
||||
group: root
|
||||
notify: reload sysctl configuration
|
||||
|
||||
- name: create /etc/wireguard/wg0.conf
|
||||
copy:
|
||||
src: "{{ inventory_dir }}/files/{{ inventory_hostname }}/etc/wireguard/wg0.conf"
|
||||
dest: /etc/wireguard/wg0.conf
|
||||
owner: root
|
||||
group: root
|
||||
notify: restart wireguard
|
@@ -1,2 +0,0 @@
|
||||
dependencies:
|
||||
- server_native-wireguard
|
Reference in New Issue
Block a user