ca7f860df582eb6e5d4f4a67b679f1d01ebf7ce2
[ansible.git] / roles / unbound / templates / fix-dns
1 #!/bin/bash
2 set -e
3
4 # Fix for some providers messing with DNS settings
5 if ! diff /etc/resolv.conf <(echo "nameserver 127.0.0.2") > /dev/null; then
6         echo "Someone messed up our DNS! Fixing it..."
7         echo "nameserver 127.0.0.2" > /etc/resolv.conf
8 {% if 'email' in group_names %}
9         # Just to make sure postfix uses the new settings
10         systemctl restart postfix
11 {% endif %}
12 fi