Commit d426a660 authored by pa's avatar pa 🌊 Committed by pa
Browse files

add extension in template

parent 700668f0
......@@ -99,6 +99,6 @@ if __name__ == "__main__":
print(template.render(machines=machines))
else:
with open(os.path.join(path, 'generated', f"dhcp.{name}.list"), 'w') as generated:
generated.write(template.render(machines=machines))
generated.write(template.render(machines=machines, name=name))
if not args.do_not_regen and subprocess.run(['/usr/bin/systemctl', 'is-active', '--quiet', 'isc-dhcp-server']).returncode == 0:
subprocess.run(['/usr/bin/systemctl', 'restart', 'isc-dhcp-server'])
{% for machine in machines %}
host {{ machine.hostname }} {
host {{ machine.hostname }}.{{ name }} {
hardware ethernet {{ machine.mac }};
fixed-address {{ machine.ip }};
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment