ansible/roles/wireguard_endpoint/tasks/main.yml

51 lines
1 KiB
YAML
Raw Normal View History

---
- name: Install required packages
2021-03-10 06:23:21 +01:00
become: true
apt:
pkg:
- ifupdown2
- wireguard
state: latest
update_cache: yes
- name: Tweak sysctl to enable IP forwarding
2021-03-10 06:23:21 +01:00
become: true
template:
src: sysctl.conf.j2
dest: /etc/sysctl.d/forwarding.conf
owner: root
group: root
mode: u=rw,g=r,o=
2021-03-10 06:23:21 +01:00
notify:
- Reload sysctl
- name: Create tunnels configurations
2021-03-10 06:23:21 +01:00
become: true
template:
src: wireguard.conf.j2
dest: "/etc/wireguard/{{ item.name }}.conf"
owner: root
group: root
mode: u=rw,g=,o=
loop: "{{ wireguard_endpoints }}"
# try to hide clear-text private keys from Ansible output
2021-02-20 21:03:06 +01:00
no_log: True
diff: no
notify:
- Reload network interfaces
- name: Create network interfaces
2021-03-10 06:23:21 +01:00
become: true
template:
src: interface.j2
dest: "/etc/network/interfaces.d/{{ item.name }}"
owner: root
group: root
mode: u=rw,g=r,o=
loop: "{{ wireguard_endpoints }}"
2021-02-20 21:03:06 +01:00
no_log: True
diff: no
notify:
- Reload network interfaces
...