Commit 7d97dda7 by Feanil Patel

Merge pull request #1608 from edx/feanil/common_cluster_updates

Feanil/common cluster updates
parents b01577ea 3032ba82
# ansible-playbook -i ec2.py commoncluster.yml --limit tag_Name_stage-edx-commoncluster -e@/path/to/vars/env-deployment.yml -T 30 --list-hosts # ansible-playbook -i ec2.py cluster_rabbitmq.yml --limit tag_Name_stage-edx-commoncluster -e@/path/to/vars/env-deployment.yml -T 30 --list-hosts
- hosts: all - hosts: all
sudo: True sudo: True
...@@ -28,14 +28,9 @@ ...@@ -28,14 +28,9 @@
tasks: tasks:
- debug: msg="{{ ansible_ec2_local_ipv4 }}" - debug: msg="{{ ansible_ec2_local_ipv4 }}"
with_items: list.results with_items: list.results
- shell: echo "rabbit@ip-{{ item|replace('.', '-') }}"
when: item != ansible_ec2_local_ipv4
with_items: hostvars.keys()
register: list
- command: rabbitmqctl stop_app - command: rabbitmqctl stop_app
- command: rabbitmqctl join_cluster {{ item.stdout }} - command: rabbitmqctl join_cluster rabbit@ip-{{ hostvars.keys()[0]|replace('.', '-') }}
when: item.stdout is defined when: hostvars.keys()[0] != ansible_ec2_local_ipv4
with_items: list.results
- command: rabbitmqctl start_app - command: rabbitmqctl start_app
post_tasks: post_tasks:
- debug: var="{{ ansible_ec2_instance_id }}" - debug: var="{{ ansible_ec2_instance_id }}"
......
% {{ ansible_managed }} % {{ ansible_managed }}
[{rabbit,
{log_levels, [{connection, info}]},
{% if RABBITMQ_CLUSTERED -%} {% if RABBITMQ_CLUSTERED -%}
{%- set hosts= [] -%} {%- set hosts= [] -%}
...@@ -7,14 +9,12 @@ ...@@ -7,14 +9,12 @@
{% do hosts.append("rabbit@ip-" + host.replace('.','-')) %} {% do hosts.append("rabbit@ip-" + host.replace('.','-')) %}
{%- endfor %} {%- endfor %}
[{rabbit, [{cluster_nodes, {['{{ hosts|join("\',\'") }}'], disc}}]
[{cluster_nodes, {['{{ hosts|join("\',\'") }}'], disc}}]}].
{%- else -%} {%- else -%}
{# If rabbitmq_clustered_hosts is set, use that instead assuming an aws stack. {# If rabbitmq_clustered_hosts is set, use that instead assuming an aws stack.
Note: That these names should include the node name prefix. eg. 'rabbit@hostname' Note: That these names should include the node name prefix. eg. 'rabbit@hostname'
#} #}
[{rabbit, [{cluster_nodes, {['{{ rabbitmq_clustered_hosts|join("\',\'") }}'], disc}}]
[{cluster_nodes, {['{{ rabbitmq_clustered_hosts|join("\',\'") }}'], disc}}]}].
{%- endif -%} {%- endif -%}
}].
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment