Mercurial > code > home > repos > infra
comparison dns.py @ 288:3af02e24eaf9
minor
author | drewp@bigasterisk.com |
---|---|
date | Sun, 21 Apr 2024 17:01:13 -0700 |
parents | e10ee3ddadcf |
children | 65e28d2e0cd8 |
comparison
equal
deleted
inserted
replaced
287:c094d23b7943 | 288:3af02e24eaf9 |
---|---|
1 from io import StringIO | 1 from io import StringIO |
2 import subprocess | 2 import subprocess |
3 from typing import cast | |
3 | 4 |
5 import pyinfra | |
4 from pyinfra import host | 6 from pyinfra import host |
5 from pyinfra.operations import files, systemd, server | 7 from pyinfra.operations import files, systemd, server |
6 from pyinfra.facts.server import Arch, LinuxDistribution | 8 from pyinfra.facts.server import Arch, LinuxDistribution |
7 | 9 |
8 is_pi = host.get_fact(LinuxDistribution)['name'] in ['Debian', 'Raspbian GNU/Linux'] | 10 is_pi = host.get_fact(LinuxDistribution)['name'] in ['Debian', 'Raspbian GNU/Linux'] |
50 files.link(path='/etc/resolv.conf', target='/run/systemd/resolve/resolv.conf', force=True) | 52 files.link(path='/etc/resolv.conf', target='/run/systemd/resolve/resolv.conf', force=True) |
51 files.template(src='templates/resolved.conf.j2', dest='/etc/systemd/resolved.conf') | 53 files.template(src='templates/resolved.conf.j2', dest='/etc/systemd/resolved.conf') |
52 systemd.service(service='systemd-resolved.service', running=True, restarted=True) | 54 systemd.service(service='systemd-resolved.service', running=True, restarted=True) |
53 | 55 |
54 | 56 |
55 pi_serial_hostname = [ | |
56 ] | |
57 | |
58 | |
59 def rpi_net_boot(): | 57 def rpi_net_boot(): |
60 files.directory(path='/opt/dnsmasq/tftp') | 58 files.directory(path='/opt/dnsmasq/tftp') |
61 for pi_serial, _ in pi_serial_hostname: | 59 for pi_serial, _ in pi_serial_hostname: |
62 files.directory(path=f'/opt/dnsmasq/tftp/{pi_serial}') | 60 files.directory(path=f'/opt/dnsmasq/tftp/{pi_serial}') |
63 # then we transfer from pi to here | 61 # then we transfer from pi to here |
92 dnsmasq_instance('10.5', house_iface='unused', dhcp_range='unused', | 90 dnsmasq_instance('10.5', house_iface='unused', dhcp_range='unused', |
93 listen_address='unused') # only works after wireguard is up | 91 listen_address='unused') # only works after wireguard is up |
94 elif host.name == 'ditto': | 92 elif host.name == 'ditto': |
95 rpi_iscsi_volumes() # move out of this file- it's not dns | 93 rpi_iscsi_volumes() # move out of this file- it's not dns |
96 elif host.name == 'pipe': | 94 elif host.name == 'pipe': |
95 # move out of this file- it's not dns | |
97 rpi_net_boot() | 96 rpi_net_boot() |
98 files.directory(path='/opt/dnsmasq') | 97 files.directory(path='/opt/dnsmasq') |
99 dnsmasq_instance('10.2', | 98 dnsmasq_instance('10.2', |
100 house_iface='eth1', | 99 house_iface='eth1', |
101 dhcp_range='10.2.0.110,10.2.0.199', | 100 dhcp_range='10.2.0.110,10.2.0.199', |