24 lines
559 B
Python
Executable File
24 lines
559 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import yaml
|
|
import sys
|
|
|
|
with open(sys.argv[1]) as fd:
|
|
config = yaml.safe_load(fd.read())
|
|
output = []
|
|
|
|
for entry in config:
|
|
for zone in entry['zones']:
|
|
for query in ('NS', 'SOA'):
|
|
job = {
|
|
'labels': {
|
|
'zone_name': zone,
|
|
'record_type': query,
|
|
'host': entry['host'],
|
|
},
|
|
'targets': entry['ns'].copy(),
|
|
}
|
|
output.append(job)
|
|
|
|
print(yaml.safe_dump(output, default_flow_style=False))
|