#cloud-config

write_files:
- path: /etc/wireguard/wg0.conf
  content: "${wg0}"
  encoding: b64
  permissions: "0600"

- path: /etc/sysctl.d/10-wireguard.conf
  content: |
    net.ipv4.ip_forward = 1

runcmd:
- apt-get update
- apt install wireguard -q -y
- sysctl -p /etc/sysctl.d/10-wireguard.conf
- systemctl enable wg-quick@wg0
- systemctl start wg-quick@wg0
