SpecialistOff.NET / Вопросы / Статьи / Фрагменты кода / Резюме / Метки / Помощь / Файлы
Назад--- example.py --- specialistoff.net.j2
#!/usr/bin/env python3
from pathlib import Path
workdir = Path(__file__).resolve().parent
domains = ['www']
j2_env = Environment(
loader=FileSystemLoader(workdir),
trim_blocks=True
)
zonetemplate = j2_env.get_template(
'specialistoff.net.j2'
).render(
domains=domains
)
with open(workdir / "specialistoff.net.zone"], 'w') as fd:
fd.write(zonetemplate)
specialistoff.net.j2
Скачать
@ IN SOA specialistoff.net. info.specialistoff.net. (
2022012001 ; serial
600 ; refresh (10 minutes)
7200 ; retry (2 hours)
8640000 ; expire (14 weeks 2 days)
86400 ; minimum (1 day)
)
NS specialistoff.net.
A 192.168.0.10
MX 10 specialistoff.net.
@ A 192.168.0.10
{% for domain in domains %}
{{ domain }} IN A 192.168.0.10
{% endfor %}