Skip to content

Instantly share code, notes, and snippets.

@bentwire
Last active September 24, 2015 23:48
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 bentwire/0a763ed4ec524b7a56b5 to your computer and use it in GitHub Desktop.
Save bentwire/0a763ed4ec524b7a56b5 to your computer and use it in GitHub Desktop.
{% set bind_interfaces = { 'lo': 0, 'eth1': 0 } %}
{% set name = grains.get('host', None) %}
{% set product, function, cluster, dc, env, num = name.split('-') %}
{% set nodes = {} %}
{% for id, val in salt['mine.get'](product~'-redis-'~cluster~'-'~dc~'-'~env~'-*', 'network.interfaces', expr_form='glob').items() %}
{% do nodes.append({ id: val }) %}
{% endfor %}
redis:
cluster:
{% for nid, val in nodes.items() %}
{% set prod, fun, clus, dc, env, node = nid.split('-') %}
{{ nid }}:
cluster_id: {{prod}}-{{fun}}-{{clus}}-{{dc}}-{{env}}
bind_ips:
{% for interface in val.items() %}
{% for port, index in bind_interfaces.items() %}
- {{ val[port]['inet'][index]['address'] }}
{% endfor %}
{% endfor %}
{% endfor %}
use_ppa: True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment