ctucx.git: ansible-configs

My personal ansible roles and playbooks [deprecated in favor of nixos]

commit 34e2206e192d51f2f76fcd6678d3ccc4f768a1e2
parent f2ac235d97c042c16297df7427048a145961a670
Author: Leah Thein <leah@toaster.home.ctu.cx>
Date: Sun, 6 Dec 2020 23:31:51 +0100

dnsmasq: add role
2 files changed, 52 insertions(+), 0 deletions(-)
A
roles/dnsmasq/tasks/main.yml
|
18
++++++++++++++++++
A
roles/dnsmasq/templates/dnsmasq.conf.j2
|
34
++++++++++++++++++++++++++++++++++
diff --git a/roles/dnsmasq/tasks/main.yml b/roles/dnsmasq/tasks/main.yml
@@ -0,0 +1,18 @@
+---
+
+- name: "Install package: dnsmasq" 
+  apk:
+   name: dnsmasq 
+   state: present
+   update_cache: yes
+
+- name: "create file: /etc/dnsmasq.d/ansible.conf"
+  template:
+    src: dnsmasq.conf.j2
+    dest: /etc/dnsmasq.d/ansible.conf
+
+- name: "Enable and restart service: dnsmasq"
+  service:
+   name: dnsmasq
+   enabled: yes
+   state: restarted
diff --git a/roles/dnsmasq/templates/dnsmasq.conf.j2 b/roles/dnsmasq/templates/dnsmasq.conf.j2
@@ -0,0 +1,34 @@
+except-interface=eth0
+no-resolv
+
+# filter what we send upstream
+domain-needed
+bogus-priv
+
+server=1.1.1.1@eth0
+server=1.0.0.1@eth0
+server=8.8.8.8@eth0
+server=8.8.4.4@eth0
+
+# allow /etc/hosts and dhcp lookups for local domains
+local=/home.ctu.cx/
+domain=home.ctu.cx
+
+expand-hosts
+read-ethers
+
+enable-ra
+quiet-ra
+
+dhcp-range=10.0.0.40, 10.0.0.254,48h
+dhcp-range=::10, ::400, constructor:brlan ra-names, slaac, 48h
+dhcp-option=option6:information-refresh-time,6h
+
+dhcp-authoritative
+dhcp-rapid-commit
+
+# IPv4 DNS server
+dhcp-option=option:dns-server,10.0.0.1
+
+# IPv4 gateway
+dhcp-option=option:router,10.0.0.1