2019-04-04 23:23:10 -04:00

38 lines
846 B
YAML

---
- name: Gather variables for each operating system
include_vars: "{{ ansible_distribution | lower }}.yaml"
- include_tasks: "setup-repo/{{ ansible_distribution | lower }}.yaml"
- name: Install packages
become: true
package:
name: "{{ wireguard_packages }}"
- name: Create configuration folder
become: true
file:
path: /etc/wireguard
state: directory
- name: Drop configuration files
become: true
template:
src: wg.conf.j2
dest: "/etc/wireguard/{{ item.name }}.conf"
loop: "{{ wireguard_links }}"
loop_control:
label: "{{ item.name }}"
notify: Restart tunnels
- meta: flush_handlers
- name: Enable and start services
become: true
service:
name: "wg-quick@{{ item.name }}"
state: started
enabled: true
loop: "{{ wireguard_links }}"
loop_control:
label: "{{ item.name }}"