kyl191 / ansible-role-openvpn

Ansible Playbook for OpenVPN on CentOS/Fedora/RHEL clones
MIT License
246 stars 219 forks source link

Make openvpn_custom_dns work as defined in Readme #175

Open danielsimkus opened 2 years ago

danielsimkus commented 2 years ago

Hello,

I was using openvpn_custom_dns along with openvpn_set_dns as true and noticed it wasn't adding the servers to my openvpn config.

Looking at the code it previously treated openvpn_custom_dns as if it was a Boolean, and instead used openvpn_dns_servers to loop through the servers:

{% if openvpn_set_dns %}
{% if openvpn_custom_dns %}
{% for srv in openvpn_dns_servers %}
push "dhcp-option DNS {{ srv }}"

It seemed to be suggesting that in our configs we set:

openvpn_set_dns: true
openvpn_custom_dns: true
openvpn_dns_servers:
 - 8.8.8.8
 - 8.8.4.4

Which contradicted the docs which state:

Screenshot 2022-01-25 at 10 05 47

I've tried to change it so we don't use openvpn_dns_servers at all, and the check for if we either add custom-servers vs the default DNS is based entirely on whether or not openvpn_custom_dns has entries in it. This makes it more in-line with what the README says

Potentially breaking changes