comparison dns.py @ 290:828d3f4da54b

rpi iscsi volumes
author drewp@bigasterisk.com
date Sun, 21 Apr 2024 17:09:10 -0700
parents 65e28d2e0cd8
children 2136320eb94d
comparison
equal deleted inserted replaced
289:65e28d2e0cd8 290:828d3f4da54b
51 systemd.service(service='systemd-resolved.service', running=True, restarted=True) 51 systemd.service(service='systemd-resolved.service', running=True, restarted=True)
52 52
53 53
54 def rpi_net_boot(): 54 def rpi_net_boot():
55 files.directory(path='/opt/dnsmasq/tftp') 55 files.directory(path='/opt/dnsmasq/tftp')
56 for pi_serial, _ in pi_serial_hostname:
57 files.directory(path=f'/opt/dnsmasq/tftp/{pi_serial}')
58 # then we transfer from pi to here
59
60
61 def rpi_iscsi_volumes():
62 iscsi_dir = '/d2/rpi-iscsi'
63 for _, pi_hostname in pi_serial_hostname:
64 out = f'{iscsi_dir}/{pi_hostname}.disk'
65 files.directory(path=iscsi_dir)
66 server.shell(f'dd if=/dev/zero of={out} count=0 bs=1 seek=5G conv=excl || true')
67 files.put(dest=f"/etc/tgt/conf.d/{pi_hostname}.conf",
68 src=StringIO(f"""
69 <target iqn.2024-03.com.bigasterisk:{pi_hostname}.target>
70 backing-store {out}
71 initiator-name iqn.2024-03.com.bigasterisk:{pi_hostname}.initiator
72 </target>
73 """))
74 # restarting is disruptive to connected pis, and they might need to be
75 # visited:
76 #systemd.service(service='tgt.service', running=True, restarted=True)
77 56
78 57
79 standard_host_dns() 58 standard_host_dns()
80 59
81 # no default instance; i'll add some specific ones below 60 # no default instance; i'll add some specific ones below
84 if host.name == 'bang': 63 if host.name == 'bang':
85 files.directory(path='/opt/dnsmasq') 64 files.directory(path='/opt/dnsmasq')
86 65
87 dnsmasq_instance('10.5', house_iface='unused', dhcp_range='unused', 66 dnsmasq_instance('10.5', house_iface='unused', dhcp_range='unused',
88 listen_address='unused') # only works after wireguard is up 67 listen_address='unused') # only works after wireguard is up
89 elif host.name == 'ditto':
90 rpi_iscsi_volumes() # move out of this file- it's not dns
91 # move out of this file- it's not dns 68 # move out of this file- it's not dns
92 if host.name == 'pipe': 69 if host.name == 'pipe':
93 rpi_net_boot() 70 rpi_net_boot()
94 files.directory(path='/opt/dnsmasq') 71 files.directory(path='/opt/dnsmasq')
95 dnsmasq_instance('10.2', 72 dnsmasq_instance('10.2',