Skip to content

Instantly share code, notes, and snippets.

Created June 12, 2015 16:49
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/794c5a997c0a89b138c6 to your computer and use it in GitHub Desktop.
Save anonymous/794c5a997c0a89b138c6 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
DC2_CIDR='1.1.1.1.0/22'
ORD_CIDR='2.2.2.2/22'
EG_CIDR='3.3.3.3/20'
SLC_CIDR='4.4.4.4/22'
LAS_CIDR='5.5.5.5/22'
def datacenter():
datacenter = {}
# Some code for logic that sets grains like
if __salt__['network.in_subnet'](DC2_CIDR):
return {'datacenter':'dc2'}
if __salt__['network.in_subnet'](ORD_CIDR):
return {'datacenter':'ord'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment