adc/ansible/roles/wg_vpn/tasks/main.yml

47 lines
1.3 KiB
YAML
Raw Normal View History

2020-01-05 00:13:19 +00:00
---
# tasks file for wg_vpn
# playbook to go from a "base configured" server to a wg vpn peer
2020-01-08 20:09:29 +00:00
2020-01-08 23:02:02 +00:00
- name: add unstable to repos
shell: |
echo "deb http://deb.debian.org/debian/ unstable main" > /etc/apt/sources.list.d/unstable.list
printf 'Package: *\nPin: release a=unstable\nPin-Priority: 90\n' > /etc/apt/preferences.d/limit-unstable
2020-01-05 00:13:19 +00:00
2020-01-08 23:02:02 +00:00
- name: install wireguard
apt:
name:
- wireguard
- build-essential
- dkms
update_cache: yes
state: latest
2020-01-05 00:13:19 +00:00
2020-01-08 23:02:02 +00:00
- name: Enable IP forwarding
sysctl: name={{ item }} value=1 state=present
with_items:
- net.ipv4.ip_forward
- net.ipv6.conf.all.forwarding
2020-01-05 00:13:19 +00:00
2020-01-08 23:02:02 +00:00
- name: Create wireguard config directory
file: state=directory path=/etc/wireguard owner=root group=root mode=0700
2020-01-05 00:13:19 +00:00
2020-01-08 23:02:02 +00:00
- name: Install wireguard configuration
template: src=wg0.conf dest=/etc/wireguard/wg0.conf owner=root group=root mode=0600
notify: restart wireguard
2020-01-05 00:13:19 +00:00
2020-01-08 23:02:02 +00:00
- name: Start wireguard
service: name=wg-quick@wg0.service enabled=yes state=started
- name: Create matrix.conf file in ~/wireguard/.
template: src=ios.conf dest=/etc/wireguard/ owner=root mode=0600
tags:
- clients
- client_matrix
- name: Create .conf file in /etc/wireguard/.
template: src=ling8.conf dest=/etc/wireguard/ owner=root mode=0600
tags:
- clients
- client_ling8