githubixx / ansible-role-wireguard

Ansible role for installing WireGuard VPN. Supports Ubuntu, Debian, Archlinx, Fedora and CentOS.
https://www.tauceti.blog/post/kubernetes-the-not-so-hard-way-with-ansible-wireguard/
563 stars 177 forks source link

`reresolve-dns.sh` script (`wireguard-tools`) #192

Open strarsis opened 12 months ago

strarsis commented 12 months ago

Thank you for this awesome ansible role!

Is there a good way of integrating the reresolve-dns.sh script with this role (https://techoverflow.net/2021/08/19/how-to-automatically-re-resolve-dns-in-wireguard-on-linux/)? Edit: Note that on Ubuntu Server minimized installs the /usr/share/doc/ files are excluded in dpkg configuration, hence an exception must be made or some other mechanism used to make the reresolve-dns.sh present on the system.

Or is it just setting up a sytemd service after this role installed wireguard?

Making it installable by this role would be a nice addition.

githubixx commented 11 months ago

Well this script is not a usual systemd service which starts a daemon but just a script with a systemd timer. So more like a cron job. I'd just go with the systemd service + timer. This is really not depended on this role and can be handled separately. It's only a few lines Ansible of code.

I currently don't have that much time to work on this but you can keep the issue open. It might be something worth to implement. The script itself seems to be placed on different locations on different OSes. E.g. for Arch Linux it's /usr/share/wireguard-tools/examples/reresolve-dns/reresolve-dns.sh. As this role supports quite a few OSes this would be something to consider. Also it definitely should be optional. So some variable would be needed to enable/disable it.