Skip to content

Instantly share code, notes, and snippets.

@deuscapturus
Last active August 29, 2015 14:08
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 deuscapturus/eb643003d85c7be97ef6 to your computer and use it in GitHub Desktop.
Save deuscapturus/eb643003d85c7be97ef6 to your computer and use it in GitHub Desktop.
SaltStack Example - Couchbase - Join cluster from mine list and validate
{% 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