Last active
June 13, 2017 02:28
-
-
Save moali87/62c073557a6b6685ee5f98c35a354053 to your computer and use it in GitHub Desktop.
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 | |
import socket | |
grains = {} | |
REDIS_MASTER = 'redis_master.hostname.com' | |
def redis_master(): | |
try: | |
REDIS_M_INFO = socket.gethostbyaddr(REDIS_MASTER) | |
redis_ip = REDIS_M_INFO[2][0] | |
except socket.gaierror: | |
return False | |
grains['redis_master'] = redis_ip | |
return grains | |
if __name__ == '__main__': | |
redis_master() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment