Skip to content

Instantly share code, notes, and snippets.

@sygibson
Created June 8, 2015 22:34
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 sygibson/6b13b147a31b4f3fc7e8 to your computer and use it in GitHub Desktop.
Save sygibson/6b13b147a31b4f3fc7e8 to your computer and use it in GitHub Desktop.
jinja template for public/cluster network
# first network returned will be the "public" network
{% set public = salt['network.subnets']()[0] -%}
{% if public -%}
public network = {{ public }}
{% else -%}
# if for some reason not defined as a salt grain - throw default
public network = UNDEFINED
{% endif -%}
# second network if exists is the "cluster" network
{% set cluster = salt['network.subnets']()[1] -%}
{% if cluster -%}
cluster network = {{ cluster }}
{% else -%}
# if not defined, set it to the "public" network
cluster network = {{ public }}
{% endif -%}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment