Skip to content

Instantly share code, notes, and snippets.

@whytewolf
Created August 11, 2017 17:35
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 whytewolf/c6ed0f158851d4decf96876575898356 to your computer and use it in GitHub Desktop.
Save whytewolf/c6ed0f158851d4decf96876575898356 to your computer and use it in GitHub Desktop.
{% if salt.match.compound('S@subnet1 or S@subnet2 or S@subnet3') %}
{% set datacenter = 'dc01' %}
{% elif salt.match.compound('S@subnet4 or S@subnet5 or S@subnet6') %}
{%set datacenter = 'dc02'%}
{% else %}
{% set datacenter = 'unknown' %}
{%endif%}
datacenter_grain:
grains.set:
- datacenter: {{datacenter}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment