commit 62305c354bd523cab49ed24f78744b46307ddf40
parent a345e980c4fd46a51ff8cd2ea1da5d53b5a0ca4b
Author: Leah Thein <leah@toaster.home.ctu.cx>
Date: Tue, 8 Dec 2020 00:28:34 +0100
parent a345e980c4fd46a51ff8cd2ea1da5d53b5a0ca4b
Author: Leah Thein <leah@toaster.home.ctu.cx>
Date: Tue, 8 Dec 2020 00:28:34 +0100
arch/dnsmasq: add role
2 files changed, 88 insertions(+), 0 deletions(-)
A
|
70
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
diff --git a/arch/roles/dnsmasq/tasks/main.yml b/arch/roles/dnsmasq/tasks/main.yml @@ -0,0 +1,18 @@ +--- + +- name: "Install package: dnsmasq" + pacman: + name: dnsmasq + state: present + update_cache: yes + +- name: "create file: /etc/dnsmasq.d/ansible.conf" + template: + src: dnsmasq.conf.j2 + dest: /etc/dnsmasq.conf + +- name: "Enable and restart service: dnsmasq" + systemd: + name: dnsmasq + enabled: yes + state: restarted
diff --git a/arch/roles/dnsmasq/templates/dnsmasq.conf.j2 b/arch/roles/dnsmasq/templates/dnsmasq.conf.j2 @@ -0,0 +1,69 @@ +{% if dnsmasq.local_service is defined and dnsmasq.local_service is true %} +local-service +{% endif %} + +{% if dnsmasq.no_resolv is defined and dnsmasq.no_resolv is true %} +no-resolv +{% endif %} + +{% if dnsmasq.domain_needed is defined and dnsmasq.domain_needed is true %} +domain-needed +{% endif %} + +{% if dnsmasq.bogus_priv is defined and dnsmasq.bogus_priv is true %} +bogus-priv +{% endif %} + +{% if dnsmasq.expand_hosts is defined and dnsmasq.expand_hosts is true %} +expand-hosts +{% endif %} + +{% if dnsmasq.read_ethers is defined and dnsmasq.read_ethers is true %} +read-ethers +{% endif %} + +{% if dnsmasq.enable_ra is defined and dnsmasq.enable_ra is true %} +enable-ra +{% endif %} + +{% if dnsmasq.quiet_ra is defined and dnsmasq.quiet_ra is true %} +quiet-ra +{% endif %} + +{% for dns_server in dnsmasq.dns_servers %} +server={{ dns_server }}@{{ dnsmasq.wan_interface }} +{% endfor %} + +{% if dnsmasq.domain is defined %} +# allow /etc/hosts and dhcp lookups for local domains +local=/{{ dnsmasq.domain }}/ +domain={{ dnsmasq.domain }} +{% endif %} + + +{% if dnsmasq.dhcp is defined %} +{% if dnsmasq.dhcp.authoritative is defined and dnsmasq.dhcp.authoritative is true %} +dhcp-authoritative +{% endif %} + +{% if dnsmasq.dhcp.rapid_commit is defined and dnsmasq.dhcp.rapid_commit is true %} +dhcp-rapid-commit +{% endif %} + +{% if dnsmasq.dhcp.sequential_ip is defined and dnsmasq.dhcp.sequential_ip is true %} +dhcp-sequential-ip +{% endif %} + +{% if dnsmasq.dhcp.ranges is defined %} +{% for dhcp_range in dnsmasq.dhcp.ranges %} +dhcp-range={{ dhcp_range }} +{% endfor %} +{% endif %} + +{% if dnsmasq.dhcp.options is defined %} +{% for dhcp_option in dnsmasq.dhcp.options %} +dhcp-option={{ dhcp_option}} +{% endfor %} +{% endif %} + +{% endif %}+ \ No newline at end of file