Skip to content

Instantly share code, notes, and snippets.

Created March 3, 2016 03:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/cdb6e304d6a07d2aeda8 to your computer and use it in GitHub Desktop.
Save anonymous/cdb6e304d6a07d2aeda8 to your computer and use it in GitHub Desktop.
#!/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