Mercurial > code > home > repos > infra
comparison dns.py @ 320:11d3bcedb9f0
updates for tofu rebuild; some dead code; start moving tasks into subdirs with their files and templates
author | drewp@bigasterisk.com |
---|---|
date | Fri, 08 Nov 2024 23:16:56 -0800 |
parents | 2e6dbebb2cb3 |
children | 4d1b6a6e65d2 |
comparison
equal
deleted
inserted
replaced
319:2e6dbebb2cb3 | 320:11d3bcedb9f0 |
---|---|
58 | 58 |
59 # no default instance; i'll add some specific ones below | 59 # no default instance; i'll add some specific ones below |
60 systemd.service(service='dnsmasq', enabled=False, running=False) | 60 systemd.service(service='dnsmasq', enabled=False, running=False) |
61 | 61 |
62 if host.name == 'bang': | 62 if host.name == 'bang': |
63 files.directory(path='/opt/dnsmasq') | |
64 | |
65 dnsmasq_instance('10.5', house_iface='unused', dhcp_range='unused', | |
66 listen_address='unused') # only works after wireguard is up | |
67 # move out of this file- it's not dns | |
68 | 63 |
69 def watchLeasesFile(): | 64 def watchLeasesFile(): |
70 """summary: | 65 """summary: |
71 1. dnsmasq_10.2 leases an address and writes to /opt/dnsmasq/10.2/leases | 66 1. dnsmasq_10.2 leases an address and writes to /opt/dnsmasq/10.2/leases |
72 2. dhcp_graph_watch.path notices that change | 67 2. dhcp_graph_watch.path notices that change |
73 3. dhcp_graph_update.service posts /opt/dnsmasq/10.2/leases to dhcp_graph (k8s deploy) | 68 3. dhcp_graph_update.service posts /opt/dnsmasq/10.2/leases to dhcp_graph (k8s deploy) |
74 4. dhcp_graph serves the data as rdf | 69 4. dhcp_graph serves the data as rdf |
75 """ | 70 """ |
76 dhcp_graph_url = "http://10.5.0.7:8005" | 71 dhcp_graph_url = "http://10.5.0.7:8005" |
77 leases = "/opt/dnsmasq/10.2/leases" | 72 leases = "/opt/dnsmasq/10.2/leases" |
78 files.put(dest='/etc/systemd/system/dhcp_graph_watch.path', src=StringIO(f''' | 73 files.put(dest='/etc/systemd/system/dhcp_graph_watch.path', |
74 src=StringIO(f''' | |
79 [Unit] | 75 [Unit] |
80 Description=dhcp leases file changed- run dhcp_graph_update | 76 Description=dhcp leases file changed- run dhcp_graph_update |
81 After=localfs.target | 77 After=localfs.target |
82 | 78 |
83 [Path] | 79 [Path] |
86 | 82 |
87 [Install] | 83 [Install] |
88 WantedBy=multi-user.target | 84 WantedBy=multi-user.target |
89 ''')) | 85 ''')) |
90 | 86 |
91 files.put(dest='/etc/systemd/system/dhcp_graph_update.service', src=StringIO(f''' | 87 files.put(dest='/etc/systemd/system/dhcp_graph_update.service', |
88 src=StringIO(f''' | |
92 [Unit] | 89 [Unit] |
93 Description=Send new dhcp leases content to dhcp_graph | 90 Description=Send new dhcp leases content to dhcp_graph |
94 After=network.target | 91 After=network.target |
95 | 92 |
96 [Service] | 93 [Service] |
100 [Install] | 97 [Install] |
101 WantedBy=multi-user.target | 98 WantedBy=multi-user.target |
102 ''')) | 99 ''')) |
103 systemd.service(service='dhcp_graph_watch.path', enabled=True, restarted=True, daemon_reload=True) | 100 systemd.service(service='dhcp_graph_watch.path', enabled=True, restarted=True, daemon_reload=True) |
104 systemd.service(service='dhcp_graph_update.service', enabled=True, restarted=True, daemon_reload=True) | 101 systemd.service(service='dhcp_graph_update.service', enabled=True, restarted=True, daemon_reload=True) |
102 | |
105 | 103 |
106 if host.name == 'pipe': | 104 if host.name == 'pipe': |
107 rpi_net_boot() | 105 rpi_net_boot() |
108 files.directory(path='/opt/dnsmasq') | 106 files.directory(path='/opt/dnsmasq') |
109 dnsmasq_instance('10.2', | 107 dnsmasq_instance('10.2', |