2021-04-22 20:31:33 +02:00
|
|
|
---
|
|
|
|
- name: Add backports to buster
|
|
|
|
apt_repository:
|
|
|
|
repo: deb http://deb.debian.org/debian buster-backports main
|
|
|
|
state: present
|
2021-07-08 00:33:13 +02:00
|
|
|
when: ('debian_buster' in group_names) or ('proxmox_buster' in group_names)
|
2021-04-22 20:49:28 +02:00
|
|
|
|
2021-04-22 23:33:09 +02:00
|
|
|
- name: Install wireguard dependencies for proxmox
|
|
|
|
apt:
|
|
|
|
name:
|
|
|
|
- pve-headers
|
|
|
|
- wireguard-dkms # May need a `dkms autoinstall` and reboot ?
|
|
|
|
state: latest
|
|
|
|
update_cache: true
|
|
|
|
register: apt_result
|
|
|
|
retries: 3
|
|
|
|
until: apt_result is succeeded
|
2021-07-08 00:33:13 +02:00
|
|
|
when: ('proxmox_buster' in group_names)
|
2021-04-22 23:33:09 +02:00
|
|
|
|
2021-04-22 20:49:28 +02:00
|
|
|
- name: Install wireguard
|
|
|
|
apt:
|
|
|
|
name:
|
|
|
|
- wireguard
|
|
|
|
state: latest
|
|
|
|
update_cache: true
|
|
|
|
register: apt_result
|
|
|
|
retries: 3
|
|
|
|
until: apt_result is succeeded
|
2021-04-22 22:51:33 +02:00
|
|
|
|
2021-07-05 02:32:59 +02:00
|
|
|
- name: Create wireguard config files
|
2021-04-23 00:40:31 +02:00
|
|
|
ansible.builtin.template:
|
2021-07-05 02:32:59 +02:00
|
|
|
src: "wiregard.conf.j2"
|
2021-04-22 22:51:33 +02:00
|
|
|
dest: "/etc/wireguard/{{ item.key }}.conf"
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: '600'
|
2021-07-08 00:33:13 +02:00
|
|
|
notify: Restart wireguard for interface
|
|
|
|
loop:
|
2021-07-10 03:38:36 +02:00
|
|
|
- "{{ lookup('dict', vpn_interfaces) }}"
|
2021-07-08 00:33:13 +02:00
|
|
|
no_log: true
|
|
|
|
|
|
|
|
- name: Enable interface
|
|
|
|
systemd:
|
|
|
|
name: "wg-quick@{{ item.key }}"
|
|
|
|
state: started
|
|
|
|
enabled: yes
|
2021-04-22 22:51:33 +02:00
|
|
|
loop:
|
2021-07-10 03:38:36 +02:00
|
|
|
- "{{ lookup('dict', vpn_interfaces) }}"
|
2021-04-23 00:40:31 +02:00
|
|
|
no_log: true
|