diff options
| author | Kumar <kumar@kumardamani.xyz> | 2021-11-23 14:59:08 +0000 |
|---|---|---|
| committer | Kumar Damani <me@kumardamani.net> | 2022-03-25 19:45:25 +0000 |
| commit | a857eb82ec9c4a79ad5e41462e2ab82c2660982e (patch) | |
| tree | 9ca51ddfb551322bd4d2fa3f949fa8898032632d /roles/wireguard_client/tasks/main.yaml | |
initial commit
Diffstat (limited to 'roles/wireguard_client/tasks/main.yaml')
| -rw-r--r-- | roles/wireguard_client/tasks/main.yaml | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/roles/wireguard_client/tasks/main.yaml b/roles/wireguard_client/tasks/main.yaml new file mode 100644 index 0000000..04814ba --- /dev/null +++ b/roles/wireguard_client/tasks/main.yaml @@ -0,0 +1,36 @@ +# https://dev.to/tangramvision/exploring-ansible-via-setting-up-a-wireguard-vpn-3389 +--- + +- name: 'Enable Debian 10 buster backports repo' + shell: + cmd: 'echo "deb http://deb.debian.org/debian buster-backports main contrib non-free" > /etc/apt/sources.list.d/buster-backports.list' + creates: '/etc/apt/sources.list.d/buster-backports.list' + +- name: 'Install Wireguard' + apt: + name: 'wireguard' + state: 'present' + update_cache: true + +- name: 'enable and persist ip forwarding' + sysctl: + name: 'net.ipv4.ip_forward' + value: "1" + state: 'present' + sysctl_set: true + reload: true + +- name: 'generate private key' + shell: + cmd: 'umask 077 && wg genkey | tee privatekey | wg pubkey > publickey' + chdir: '/etc/wireguard' + creates: '/etc/wireguard/publickey' + +- name: 'create client wireguard config' + template: + dest: '/etc/wireguard/wg0.conf' + src: 'wg0.conf.j2' + owner: 'root' + group: 'root' + mode: '600' + notify: 'restart wireguard' |
