From 1ca623a0380523cd55fd720adb684c5cd3099c54 Mon Sep 17 00:00:00 2001 From: marcsello Date: Tue, 9 Nov 2021 03:11:35 +0100 Subject: [PATCH] Added dns fix magic --- files/resolv.conf | 5 +++++ prepare.yaml | 3 +++ tasks/fix-dns-resolution.yaml | 24 ++++++++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 files/resolv.conf create mode 100644 tasks/fix-dns-resolution.yaml diff --git a/files/resolv.conf b/files/resolv.conf new file mode 100644 index 0000000..760e136 --- /dev/null +++ b/files/resolv.conf @@ -0,0 +1,5 @@ +# This file is Ansible managed... or something +nameserver 152.66.208.1 +nameserver 152.66.208.29 +nameserver 152.66.115.1 +nameserver 152.66.116.1 \ No newline at end of file diff --git a/prepare.yaml b/prepare.yaml index fa2cded..629ca29 100644 --- a/prepare.yaml +++ b/prepare.yaml @@ -19,5 +19,8 @@ - name: "clean motd" import_tasks: tasks/clean-motd.yaml + - name: "fix dns" + import_tasks: tasks/fix-dns-resolution.yaml + - name: "setup networking" import_tasks: tasks/static-networking.yaml \ No newline at end of file diff --git a/tasks/fix-dns-resolution.yaml b/tasks/fix-dns-resolution.yaml new file mode 100644 index 0000000..5d3e001 --- /dev/null +++ b/tasks/fix-dns-resolution.yaml @@ -0,0 +1,24 @@ +- name: "disable systemd-resolved" + systemd: + name: systemd-resolved + state: stopped + enabled: no + masked: yes + +- name: check if resolvconf linked + stat: + path: /etc/resolv.conf + register: link + +- name: remove symlink + file: + path: /etc/resolv.conf + state: absent + when: link.stat.islnk is defined and link.stat.islnk + +- name: set very good resolv config + copy: + src: resolv.conf + dest: /etc/resolv.conf + mode: 644 + owner: root \ No newline at end of file