-
-
Save bentwire/0a763ed4ec524b7a56b5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% 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