Skip to content

Instantly share code, notes, and snippets.

Created August 7, 2017 13:14
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/a2039207eec88da9879efc39d4b86715 to your computer and use it in GitHub Desktop.
Save anonymous/a2039207eec88da9879efc39d4b86715 to your computer and use it in GitHub Desktop.
{% set default = ['192.168.1.1'] %}
{% set gateway = salt.network.default_route().0.gateway %}
{% set lookup_table = (
'192.168.111.10', ['192.168.111.10'],
'10.120.16.254', ['10.120.11.207', '10.120.11.141' ]
)
%}
{% if lookup_table[gateway] is defined %}
{% server = lookup_table[gateway] %}
{% else %}
{% server = default %}
{% endif%}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment