From b9cbbb73ad2030dfe23eac701f336e8e91faf900 Mon Sep 17 00:00:00 2001 From: shockrah Date: Wed, 24 Apr 2024 21:22:05 -0700 Subject: [PATCH] Setup dnsmasq --- lab/setup-dns-server.yml | 8 ++++++++ lab/tasks/install-dnsmasq.yml | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 lab/setup-dns-server.yml create mode 100644 lab/tasks/install-dnsmasq.yml diff --git a/lab/setup-dns-server.yml b/lab/setup-dns-server.yml new file mode 100644 index 0000000..a0a9906 --- /dev/null +++ b/lab/setup-dns-server.yml @@ -0,0 +1,8 @@ +--- +- hosts: lab + remote_user: cluster-master + tasks: + - name: Setup DNS MASQ + become: yes + import_tasks: tasks/install-dnsmasq.yml + diff --git a/lab/tasks/install-dnsmasq.yml b/lab/tasks/install-dnsmasq.yml new file mode 100644 index 0000000..1569ebe --- /dev/null +++ b/lab/tasks/install-dnsmasq.yml @@ -0,0 +1,33 @@ +- name: Install dnsmasq + apt: + name: dnsmasq + update_cache: yes +- name: Ensure config ready for local network use + lineinfile: + path: /etc/dnsmasq.conf + line: "{{ item }}" + state: present + loop: + - domain-needed + - bogus-priv + - "cache-size=1000" + - "server=208.67.222.222" + - "server=208.67.220.220" +- name: Add entries to the /etc/hosts file + lineinfile: + path: /etc/hosts + line: "192.168.1.100 {{ item }}" + loop: + - nginx.lan + - git.lan +- name: Stop resolvd from ever being a thing again + systemd_service: + name: systemd-resolved + state: stopped + masked: yes + enabled: no +- name: Restart the dnsmasq service + service: + state: restarted + name: dnsmasq +