Created
March 3, 2016 03:25
-
-
Save anonymous/cdb6e304d6a07d2aeda8 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 | |
# -*- coding: utf-8 -*- | |
from salt.modules import network | |
def ip_type(): | |
grains = {} | |
ip_addresses = network.ipaddrs() | |
if ip_addresses: | |
for ip in ip_addresses: | |
if network.is_private(ip): | |
grains['local_ip'] = ip | |
else: | |
grains['public_ip'] = ip | |
return grains | |
if __name__ == "__main__": | |
print ip_type() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment