Created
January 19, 2016 05:51
-
-
Save kafecho/465c4f7e4a4f506d0ba8 to your computer and use it in GitHub Desktop.
Ansible steps to setup the CouchDB 2.x cluster after CouchDB 2.xhas been installed
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
# The steps below are not necessary if an admin account as been created and port and bind address are already configured | |
# I already do this via Ansible | |
#- name: enable the cluster | |
# uri: HEADER_Content-Type="application/json" user=admin password=password force_basic_auth=yes method=POST url=http://127.0.0.1:5984/_cluster_setup body='{"action":"enable_cluster"}' | |
# when: inventory_hostname == "{{ groups.couches[0] }}" | |
# tags: enable_cluster | |
# ignore_errors: yes | |
# Register all the nodes that are part of the couches inventory group. | |
# Registration is done from the 1st node in that group. | |
- name: add nodes to the cluster | |
uri: status_code=201,409 HEADER_Content-Type="application/json" user=admin password=password force_basic_auth=yes method=POST url=http://127.0.0.1:5984/_cluster_setup body='{"action":"add_node","username":"admin","password":"password","host":"{{ item }}","port":5984}' | |
with_items: groups['couches'] | |
when: inventory_hostname == "{{ groups.couches[0] }}" and inventory_hostname != item | |
tags: add_nodes | |
- name: finish the cluster | |
uri: status_code=201 HEADER_Content-Type="application/json" user=admin password=password force_basic_auth=yes method=POST url=http://127.0.0.1:5984/_cluster_setup body='{"action":"finish_cluster"}' | |
tags: finish_cluster | |
when: inventory_hostname == "{{ groups.couches[0] }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment