44 lines
1.1 KiB
YAML
44 lines
1.1 KiB
YAML
- hosts: wg0
|
|
become: "true"
|
|
tasks:
|
|
####################
|
|
# - Wireguard
|
|
####################
|
|
- name: "Install Wireguard Tools"
|
|
ansible.builtin.apt:
|
|
state: "present"
|
|
name: "wireguard"
|
|
|
|
- name: "systemd-networkd: Install wg0 Device"
|
|
template:
|
|
src: "./templates/99-wg0.netdev"
|
|
dest: "/etc/systemd/network/99-wg0.netdev"
|
|
owner: "root"
|
|
group: "systemd-network"
|
|
mode: "0640"
|
|
|
|
- name: "systemd-networkd: Install wg0 Network"
|
|
template:
|
|
src: "./templates/99-wg0.network"
|
|
dest: "/etc/systemd/network/99-wg0.network"
|
|
owner: "root"
|
|
group: "systemd-network"
|
|
mode: "0640"
|
|
|
|
- name: "Restart systemd-networkd"
|
|
systemd:
|
|
name: "systemd-networkd.service"
|
|
state: "restarted"
|
|
|
|
####################
|
|
# - Wireguard - Enable Packet Forwarding
|
|
####################
|
|
- name: "Set net.ipv4.ip_forward = 1"
|
|
sysctl:
|
|
state: "present"
|
|
name: "net.ipv4.ip_forward"
|
|
value: "1"
|
|
reload: "yes"
|
|
|
|
|