Created
October 7, 2013 11:50
-
-
Save stelcheck/6866552 to your computer and use it in GitHub Desktop.
set_fact or shell?
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
- name: If undefined set bootstrap to the first node of the cluster | |
set_fact: | |
bootstrap: "{{ groups[cluster_name]|first }}" | |
when: bootstrap == False or bootstrap is not defined | |
tags: | |
- couchbase | |
- bootstrap | |
- name: Check if the current machine is part of the cluster | |
shell: > | |
{{ couchbase_cmd }} server-list \ | |
-c {{ hostvars[bootstrap]['ansible_' + private_interface]['ipv4']['address'] }}:8091 \ | |
-u {{ admin_user }} \ | |
-p {{ admin_password }} \ | |
| grep {{ hostvars[inventory_hostname]['ansible_' + private_interface]['ipv4']['address'] }} | |
ignore_errors: True | |
register: is_member | |
tags: | |
- couchbase | |
- bootstrap | |
- name: Add nodes to the cluster | |
shell: > | |
{{ couchbase_cmd }} server-add \ | |
-c {{ hostvars[bootstrap]['ansible_' + private_interface]['ipv4']['address'] }}:8091 \ | |
-u {{ admin_user }} \ | |
-p {{ admin_password }} \ | |
--server-add={{ hostvars[inventory_hostname]['ansible_' + private_interface]['ipv4']['address'] }}:8091 \ | |
--server-add-username={{ admin_user }} \ | |
--server-add-password={{ admin_password }} | |
when: is_member.rc != 0 | |
notify: | |
- Rebalance the cluster | |
tags: | |
- couchbase | |
- bootstrap |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment