You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/roles/vpn/tasks/main.yml

42 lines
1.0 KiB
YAML

---
- name: Add backports to buster
apt_repository:
repo: deb http://deb.debian.org/debian buster-backports main
state: present
when: ansible_facts["lsb"]["codename"] == "buster"
- name: Install wireguard dependencies for proxmox
apt:
name:
- pve-headers
- wireguard-dkms # May need a `dkms autoinstall` and reboot ?
state: latest
update_cache: true
when: ('proxmox' in group_names)
- name: Install wireguard
apt:
name:
- wireguard
state: latest
update_cache: true
- name: Create wireguard config files
ansible.builtin.template:
src: "wiregard.conf.j2"
dest: "/etc/wireguard/{{ item.key }}.conf"
owner: root
group: root
mode: '600'
notify: Restart wireguard for interface
loop: "{{ vpn_interfaces | dict2items }}"
no_log: "{{ enable_no_log | default('true') }}"
- name: Enable interface
systemd:
name: "wg-quick@{{ item.key }}"
state: started
enabled: yes
loop: "{{ vpn_interfaces | dict2items }}"
no_log: "{{ enable_no_log | default('true') }}"