-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from hellofresh/fix/cluster_fixes
Fix/cluster fixes
- Loading branch information
Showing
9 changed files
with
151 additions
and
13 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,28 @@ | ||
--- | ||
|
||
- name: cluster | check cluster group | ||
- name: check | cluster group should be valid | ||
fail: | ||
msg="Your configuration is not valid 'rabbitmq_cluster_group' varaible with value '{{ rabbitmq_cluster_group }}' is not valid group." | ||
when: "{{ groups[rabbitmq_cluster_group] is not defined }}" | ||
|
||
- name: check | get rabbitmq version in each node in the cluster | ||
shell: rabbitmqctl status|grep "{rabbit,\"RabbitMQ\"" | cut -d, -f3 | cut -d "\"" -f2 | ||
delegate_to: "{{ item }}" | ||
changed_when: false | ||
run_once: true | ||
with_items: "{{ groups[rabbitmq_cluster_group] }}" | ||
register: cluster_versions_command | ||
|
||
- name: check | Create a list of nodes and versions | ||
set_fact: | ||
rabbit_cluster_nodes_version: "{{ [{ 'node': item.item, 'version': item.stdout }] + rabbit_cluster_nodes_version }}" | ||
with_items: "{{ cluster_versions_command.results }}" | ||
run_once: true | ||
|
||
# Filter out node values that are not the same version then compae with original node version | ||
# if lists dont match then we have different versions in our cluster | ||
- name: check | Fail if version in cluster dont match | ||
fail: | ||
msg="Rabbiqmq version in cluster dont match. Node versions = {{rabbit_cluster_nodes_version }}" | ||
run_once: true | ||
when: "{{ rabbit_cluster_nodes_version | selectattr('version', 'equalto', rabbit_cluster_nodes_version[0]['version']) | list != rabbit_cluster_nodes_version }}" |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
if [ "$1" == "run" ]; then | ||
echo "" | ||
echo "**** Running tests ****" | ||
echo "-> Docker creating userdefined network" | ||
docker network create --subnet 192.168.110.0/24 cluster_network | ||
|
||
echo "-> Create cluster1" | ||
bundle exec kitchen create cluster1 | ||
|
||
echo "-> Create cluster2" | ||
bundle exec kitchen create cluster2 | ||
|
||
elif [ "$1" == "destroy" ]; then | ||
set +e | ||
echo "" | ||
echo "**** Running destroy ****" | ||
|
||
echo "-> Destroy cluster1 " | ||
bundle exec kitchen destroy cluster1 | ||
docker rm cluster1 | ||
|
||
echo "-> Destroy cluster2 " | ||
bundle exec kitchen destroy cluster2 | ||
docker rm cluster2 | ||
|
||
echo "-> Docker remove userdefined network" | ||
docker network rm cluster_network | ||
else | ||
echo "unsupported option '$1'" | ||
echo "usage [ run | destroy ]" | ||
exit 1 | ||
fi |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,42 @@ | ||
cluster_2.yml | ||
--- | ||
|
||
- hosts: all | ||
become: true | ||
vars: | ||
rabbitmq_ssl : false | ||
#rabbitmq_plugins : ["rabbitmq_management","rabbitmq_tracing"] | ||
rabbitmq_conf_tcp_listeners_address : "0.0.0.0" | ||
|
||
rabbitmq_vhost_definitions : | ||
- name : "vhost_cluster1" | ||
- name : "ha.cluster" | ||
|
||
rabbitmq_users_definitions : | ||
- vhost : "vhost_cluster1" | ||
user : cluster1 | ||
password : "password" | ||
force : no | ||
|
||
- vhost : "/" | ||
user : "admin" | ||
password : "password" | ||
force : no | ||
tags : ['administrator'] | ||
rabbitmq_clustering : true | ||
rabbitmq_cluster_group : "rabbitmq-cluster" | ||
rabbitmq_cluster_post_fix_domain : "" | ||
rabbitmq_erlang_cookie : "MYCOOKIE" | ||
rabbitmq_cluster_debug : true | ||
|
||
# HA Policy anythin prefixed with ha. will be mirrored on all nodes | ||
rabbitmq_policy_configuration : | ||
- name : "high availability policy" | ||
vhost : "/" | ||
pattern : "^ha\\." | ||
tags : '{"ha-mode":"all"}' | ||
|
||
rabbitmq_cluster_api_user : "api-automation" | ||
rabbitmq_cluster_api_password : "password" | ||
|
||
roles: | ||
- role: rabbitmq |