infrastructure/ansible/roles/ingress/tasks/wireguard.yml

35 lines
663 B
YAML
Raw Normal View History

- name: Install Wireguard
package:
name:
- wireguard
become: true
- name: Get wireguard credentials
set_fact:
ingress_wireguard: "{{ wireguard.clients.ingress }}"
- name: Wireguard config
template:
src: files/wireguard.conf
dest: /etc/wireguard/wg0.conf
mode: "0600"
backup: true
become: true
notify: restart wireguard
- name: Enable wireguard
service:
name: wg-quick@wg0
enabled: true
become: true
- name: Enable p2p communication
sysctl:
name: net.ipv4.ip_forward
value: "1"
sysctl_set: true
state: present
reload: true
sysctl_file: /etc/sysctl.d/99-sysctl.conf
become: true