Skip to content

Commit bb12c4f

Browse files
committed
Development VMs: override DNS configuration
Override default DNS configuration of development VMs (including the controller), because it does not work reliably on Windows-based VMs. Use the Google DNS servers instead.
1 parent 077ae21 commit bb12c4f

File tree

7 files changed

+86
-0
lines changed

7 files changed

+86
-0
lines changed

environments/development/host_vars/epos-msl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
ansible_host: 192.168.60.10 # EPOS-MSL host
88
ansible_user: vagrant # Administrative user on instance for Ansible
99
ansible_ssh_private_key_file: vagrant/ssh/vagrant # Path to private key file of administrative user
10+
commons_use_google_dns: true
1011

1112
#########################
1213
# EPOS-MSL configuration

roles/common/defaults/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
# copyright Utrecht University
3+
4+
commons_use_google_dns: false

roles/common/files/resolved.conf

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# This file is part of systemd.
2+
#
3+
# systemd is free software; you can redistribute it and/or modify it
4+
# under the terms of the GNU Lesser General Public License as published by
5+
# the Free Software Foundation; either version 2.1 of the License, or
6+
# (at your option) any later version.
7+
#
8+
# Entries in this file show the compile time defaults.
9+
# You can change settings by editing this file.
10+
# Defaults can be restored by simply deleting this file.
11+
#
12+
# See resolved.conf(5) for details
13+
14+
[Resolve]
15+
DNS=8.8.8.8
16+
FallbackDNS=8.8.4.4
17+
#Domains=
18+
#LLMNR=no
19+
#MulticastDNS=no
20+
#DNSSEC=no
21+
#DNSOverTLS=no
22+
#Cache=no-negative
23+
#DNSStubListener=yes
24+
#ReadEtcHosts=yes

roles/common/handlers/main.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,9 @@
55
ansible.builtin.service:
66
name: firewalld
77
state: restarted
8+
9+
10+
- name: Restart systemd-resolved
11+
ansible.builtin.service:
12+
name: systemd-resolved
13+
state: restarted

roles/common/tasks/google_dns.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
# copyright Utrecht University
3+
4+
- name: Update systemd-resolved config to use Google DNS servers
5+
ansible.builtin.copy:
6+
src: files/resolved.conf
7+
dest: /etc/systemd/resolved.conf
8+
owner: root
9+
group: root
10+
mode: "0644"
11+
notify: Restart systemd-resolved
12+
13+
14+
- name: Flush handlers for immediate effect of changing DNS configuration
15+
ansible.builtin.meta: flush_handlers

roles/common/tasks/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
---
22
# copyright Utrecht University
33

4+
- name: Update local DNS settings
5+
ansible.builtin.import_tasks: google_dns.yml
6+
when: commons_use_google_dns
47
- name: Run apt update
58
ansible.builtin.import_tasks: apt_update.yml
69
- name: Configure firewall

vagrant/provision_controller.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,39 @@
44
set -e
55
set -x
66

7+
# Configure VM to use Google DNS servers - the default configuration
8+
# does not work reliably on Windows.
9+
10+
cat << RESOLVEDCONF > resolved.conf
11+
# This file is part of systemd.
12+
#
13+
# systemd is free software; you can redistribute it and/or modify it
14+
# under the terms of the GNU Lesser General Public License as published by
15+
# the Free Software Foundation; either version 2.1 of the License, or
16+
# (at your option) any later version.
17+
#
18+
# Entries in this file show the compile time defaults.
19+
# You can change settings by editing this file.
20+
# Defaults can be restored by simply deleting this file.
21+
#
22+
# See resolved.conf(5) for details
23+
24+
[Resolve]
25+
DNS=8.8.8.8
26+
FallbackDNS=8.8.4.4
27+
#Domains=
28+
#LLMNR=no
29+
#MulticastDNS=no
30+
#DNSSEC=no
31+
#DNSOverTLS=no
32+
#Cache=no-negative
33+
#DNSStubListener=yes
34+
#ReadEtcHosts=yes
35+
RESOLVEDCONF
36+
37+
sudo cp resolved.conf /etc/systemd
38+
sudo systemctl restart systemd-resolved
39+
740
sudo apt update
841

942
# Install Git if not present.

0 commit comments

Comments
 (0)