Created
November 25, 2015 08:01
-
-
Save wido/84b4ceb56c9d4b26658f to your computer and use it in GitHub Desktop.
Use Local Salt client to populate DNS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Fetch all IPv6 addresses of Minions and generate local | |
unbound data based on the output | |
""" | |
import json | |
import salt.client | |
import salt.output.json_out | |
local = salt.client.LocalClient() | |
ret = local.cmd('*', 'grains.get', ['ipv6:0']) | |
for host, addr in ret.items(): | |
print("local-data: \"%s. 1h IN AAAA %s\"" % (host, addr)) | |
print("local-data-ptr: \"%s 1h %s.\"" % (addr, host)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment