Mercurial > code > home > repos > infra
diff dns.py @ 103:8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
author | drewp@bigasterisk.com |
---|---|
date | Fri, 15 Jul 2022 15:24:44 -0700 |
parents | 9ec487a381e2 |
children | 5faa7e3aa38f |
line wrap: on
line diff
--- a/dns.py Fri Jul 15 14:51:12 2022 -0700 +++ b/dns.py Fri Jul 15 15:24:44 2022 -0700 @@ -2,30 +2,15 @@ from pyinfra.operations import apt, files, systemd -def resolv_conf_use_systemd_networkd(): - files.link(path='/etc/resolv.conf', target='/run/systemd/resolve/resolv.conf', force=True) - - -def resolv_conf_static_file(): - files.file(path='/etc/resolv.conf', present=False, force=True) - files.template( - src='templates/resolv.conf.j2', - dest='/etc/resolv.conf', - # review this- it's probably a bad dep on bang. maybe both 10.5.0.1 and a public ns would be ok - ns='10.5.0.1' if host.name in ['prime', 'plus'] else '10.2.0.3', - force=True) - - def dnsmasq_instance(net_name, house_iface, dhcp_range, router): files.directory(path=f'/opt/dnsmasq/{net_name}') - files.template( - src='templates/dnsmasq/dnsmasq.conf.j2', - dest=f'/opt/dnsmasq/{net_name}/dnsmasq.conf', - net=net_name, - house_iface=house_iface, - dhcp_range=dhcp_range, - router=router, - dhcp_enabled=net_name == '10.2' and host.name == 'pipe') + files.template(src='templates/dnsmasq/dnsmasq.conf.j2', + dest=f'/opt/dnsmasq/{net_name}/dnsmasq.conf', + net=net_name, + house_iface=house_iface, + dhcp_range=dhcp_range, + router=router, + dhcp_enabled=net_name == '10.2' and host.name == 'pipe') files.template(src='templates/dnsmasq/hosts.j2', dest=f'/opt/dnsmasq/{net_name}/hosts', net=net_name) files.template(src='/dev/null', dest=f'/opt/dnsmasq/{net_name}/dhcp_hosts', net=net_name) @@ -37,7 +22,7 @@ files.template(src='templates/hosts.j2', dest='/etc/hosts') -resolv_conf_use_systemd_networkd() +files.link(path='/etc/resolv.conf', target='/run/systemd/resolve/resolv.conf', force=True) files.template(src='templates/resolved.conf.j2', dest='/etc/systemd/resolved.conf') systemd.service(service='systemd-resolved.service', running=True, restarted=True)