Last active
August 29, 2015 14:08
-
-
Save deuscapturus/eb643003d85c7be97ef6 to your computer and use it in GitHub Desktop.
SaltStack Example - Couchbase - Join cluster from mine list and validate
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 couchbaselist = salt['mine.get']('G@roles:couchbase and G@deployment:production', 'network.interfaces', 'compound').items() %} | |
cb: | |
pkg.installed: | |
- sources: | |
- couchbase-server: http://packages.couchbase.com/releases/3.0.0/couchbase-server-community-3.0.0-centos6.x86_64.rpm | |
{% for server in couchbaselist %} | |
{% if server[0] != grains['id'] %} | |
{% if salt['publish.publish'](server[0], 'test.ping')[server[0]] %} | |
join_cluster: | |
cmd.wait: | |
- name: /opt/couchbase/bin/couchbase-cli rebalance -c {{ server[0] }}:8091 --server-add={{ grains['id'] }}:8091 --server-add-username={{ cb_settings.username }} --server-add-password="{{ cb_settings.password }}" -u {{ cb_settings.username }} -p "{{ cb_settings.password }}" | |
- watch: | |
- pkg: cb | |
- require: | |
- pkg: cb | |
{% break %} | |
{% endif %} | |
{% endif %} | |
{% endfor %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment