mmt-infra/playbooks/roles/wireguard-endpoint/tasks/main.yml

41 lines
792 B
YAML
Raw Normal View History

2024-05-01 04:33:35 -04:00
---
- name: Install wireguard
ansible.builtin.apt:
name:
- wireguard
state: latest
- name: Copy config
ansible.builtin.copy:
src: wireguard.cfg
dest: /etc/wireguard/simponic.conf
owner: root
group: root
mode: 0600
- name: Enable and persist ip forwarding
ansible.builtin.sysctl:
name: net.ipv4.ip_forward
value: "1"
state: present
sysctl_set: true
reload: true
- name: Allow wireguard endpoint ufw
ansible.builtin.ufw:
rule: allow
port: '51820'
proto: 'udp'
- name: Start wireguard and enable on boot
ansible.builtin.systemd:
name: wg-quick@simponic
enabled: true
state: started
- name: Hotreload wireguard
ansible.builtin.shell: >
bash -c
"wg syncconf mmtmesh <(wg-quick strip mmtmesh)"