Last active
October 29, 2015 18:27
-
-
Save strlng/b272921182c35cdbe158 to your computer and use it in GitHub Desktop.
Generate text necessary to create DHCP static reservations for OS X Server via command line
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/python | |
import uuid | |
# Two dimensional array consisting of MAC Address, IP Address, Name | |
imacs=[["xx:xx:xx:xx:xx:xx","xxx.xxx.xxx.xxx","hostname"]] | |
for imac in imacs: | |
uniqueid = uuid.uuid4() | |
command = "dhcp:static_maps:_array_id:" + str(uniqueid) + " = create\n" | |
command += "dhcp:static_maps:_array_id:" + str(uniqueid) + ":en_address:_array_index:0 = \"" + imac[0] + "\"\n" | |
command += "dhcp:static_maps:_array_id:" + str(uniqueid) + ":ip_address:_array_index:0 = \"" + imac[1] + "\"\n" | |
command += "dhcp:static_maps:_array_id:" + str(uniqueid) + ":name = \"" + imac[2] + "\"" | |
print command |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment