summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-x[-rw-r--r--]scripts/rabbitmq-defaults1
-rw-r--r--scripts/rabbitmq-defaults.bat4
-rw-r--r--scripts/rabbitmq-env11
-rw-r--r--scripts/rabbitmq-env.bat4
-rwxr-xr-xscripts/rabbitmq-server62
-rwxr-xr-xscripts/rabbitmq-server-ha.ocf49
-rw-r--r--scripts/rabbitmq-server.bat24
-rw-r--r--scripts/rabbitmq-service.bat30
-rwxr-xr-xscripts/rabbitmqctl2
-rw-r--r--scripts/set_rabbitmq_policy.sh5
-rw-r--r--scripts/travis_test_ocf_ra.sh30
11 files changed, 178 insertions, 44 deletions
diff --git a/scripts/rabbitmq-defaults b/scripts/rabbitmq-defaults
index c5d87822a2..baffce80de 100644..100755
--- a/scripts/rabbitmq-defaults
+++ b/scripts/rabbitmq-defaults
@@ -40,6 +40,5 @@ MNESIA_BASE=${SYS_PREFIX}/var/lib/rabbitmq/mnesia
ENABLED_PLUGINS_FILE=${SYS_PREFIX}/etc/rabbitmq/enabled_plugins
PLUGINS_DIR="${RABBITMQ_HOME}/plugins"
-IO_THREAD_POOL_SIZE=64
CONF_ENV_FILE=${SYS_PREFIX}/etc/rabbitmq/rabbitmq-env.conf
diff --git a/scripts/rabbitmq-defaults.bat b/scripts/rabbitmq-defaults.bat
index 27edd0d11e..8fff5ea827 100644
--- a/scripts/rabbitmq-defaults.bat
+++ b/scripts/rabbitmq-defaults.bat
@@ -46,6 +46,4 @@ REM PLUGINS_DIR="${RABBITMQ_HOME}/plugins"
for /f "delims=" %%F in ("!TDP0!..\plugins") do set PLUGINS_DIR=%%~dpsF%%~nF%%~xF
REM CONF_ENV_FILE=${SYS_PREFIX}/etc/rabbitmq/rabbitmq-env.conf
-if "!RABBITMQ_CONF_ENV_FILE!"=="" (
- set RABBITMQ_CONF_ENV_FILE=!RABBITMQ_BASE!\rabbitmq-env-conf.bat
-)
+set CONF_ENV_FILE=!RABBITMQ_BASE!\rabbitmq-env-conf.bat
diff --git a/scripts/rabbitmq-env b/scripts/rabbitmq-env
index dffed035ea..35239620ca 100644
--- a/scripts/rabbitmq-env
+++ b/scripts/rabbitmq-env
@@ -65,20 +65,15 @@ RABBITMQ_HOME="$(rmq_realpath "${RABBITMQ_SCRIPTS_DIR}/..")"
## Common defaults
SERVER_ERL_ARGS="+P 1048576"
-# warn about old rabbitmq.conf file, if no new one
-if [ -f /etc/rabbitmq/rabbitmq.conf ] && \
- [ ! -f ${CONF_ENV_FILE} ] ; then
- echo -n "WARNING: ignoring /etc/rabbitmq/rabbitmq.conf -- "
- echo "location has moved to ${CONF_ENV_FILE}"
-fi
-
# We save the current value of $RABBITMQ_PID_FILE in case it was set by
# an init script. If $CONF_ENV_FILE overrides it again, we must ignore
# it and warn the user.
saved_RABBITMQ_PID_FILE=$RABBITMQ_PID_FILE
## Get configuration variables from the configure environment file
-[ -f ${CONF_ENV_FILE} ] && . ${CONF_ENV_FILE} || true
+[ "x" = "x$RABBITMQ_CONF_ENV_FILE" ] && RABBITMQ_CONF_ENV_FILE=${CONF_ENV_FILE}
+
+[ -f ${RABBITMQ_CONF_ENV_FILE} ] && . ${RABBITMQ_CONF_ENV_FILE} || true
if [ "$saved_RABBITMQ_PID_FILE" -a \
"$saved_RABBITMQ_PID_FILE" != "$RABBITMQ_PID_FILE" ]; then
diff --git a/scripts/rabbitmq-env.bat b/scripts/rabbitmq-env.bat
index d5df9ddbd6..ea9cf45962 100644
--- a/scripts/rabbitmq-env.bat
+++ b/scripts/rabbitmq-env.bat
@@ -47,6 +47,10 @@ REM set SERVER_ERL_ARGS=+P 1048576
REM ## Get configuration variables from the configure environment file
REM [ -f ${CONF_ENV_FILE} ] && . ${CONF_ENV_FILE} || true
+if "!RABBITMQ_CONF_ENV_FILE!"=="" (
+ set RABBITMQ_CONF_ENV_FILE=!CONF_ENV_FILE!
+)
+
if exist "!RABBITMQ_CONF_ENV_FILE!" (
call "!RABBITMQ_CONF_ENV_FILE!"
)
diff --git a/scripts/rabbitmq-server b/scripts/rabbitmq-server
index 548a085434..ab2975feb1 100755
--- a/scripts/rabbitmq-server
+++ b/scripts/rabbitmq-server
@@ -47,7 +47,7 @@ case "$(uname -s)" in
exit $EX_CANTCREAT
fi
if ! echo $$ > ${RABBITMQ_PID_FILE}; then
- # Bettern diagnostics - otherwise the only report in logs is about failed 'echo'
+ # Better diagnostics - otherwise the only report in logs is about failed 'echo'
# command, but without any other details: neither what script has failed nor what
# file output was redirected to.
echo "Failed to write pid file: ${RABBITMQ_PID_FILE}"
@@ -58,8 +58,13 @@ esac
RABBITMQ_EBIN_ROOT="${RABBITMQ_HOME}/ebin"
+[ "$NOTIFY_SOCKET" ] && RUNNING_UNDER_SYSTEMD=true
+
set +e
+# NOTIFY_SOCKET is needed here to prevent epmd from impersonating the
+# success of our startup sequence to systemd.
+NOTIFY_SOCKET= \
RABBITMQ_CONFIG_FILE=$RABBITMQ_CONFIG_FILE \
RABBITMQ_DIST_PORT=$RABBITMQ_DIST_PORT \
${ERL_DIR}erl -pa "$RABBITMQ_EBIN_ROOT" \
@@ -112,7 +117,24 @@ fi
# there is no other way of preventing their expansion.
set -f
+# Lazy initialization of threed pool size - if it wasn't set
+# explicitly. This parameter is only needed when server is starting,
+# so it makes no sense to do this calculations in rabbitmq-env or
+# rabbitmq-defaults scripts.
+ensure_thread_pool_size() {
+ if [ -z "${RABBITMQ_IO_THREAD_POOL_SIZE}" ]; then
+ RABBITMQ_IO_THREAD_POOL_SIZE=$(
+ ${ERL_DIR}erl -pa "$RABBITMQ_EBIN_ROOT" \
+ -boot "${CLEAN_BOOT_FILE}" \
+ -noinput \
+ -s rabbit_misc report_default_thread_pool_size
+ )
+ fi
+}
+
start_rabbitmq_server() {
+ ensure_thread_pool_size
+ check_start_params &&
RABBITMQ_CONFIG_FILE=$RABBITMQ_CONFIG_FILE \
exec ${ERL_DIR}erl \
-pa ${RABBITMQ_EBIN_ROOT} \
@@ -151,7 +173,39 @@ stop_rabbitmq_server() {
fi
}
-if [ 'x' = "x$RABBITMQ_ALLOW_INPUT" -a -z "$detached" ]; then
+check_start_params() {
+ check_not_empty RABBITMQ_BOOT_MODULE
+ check_not_empty RABBITMQ_NAME_TYPE
+ check_not_empty RABBITMQ_NODENAME
+ check_not_empty SASL_BOOT_FILE
+ check_not_empty RABBITMQ_IO_THREAD_POOL_SIZE
+}
+
+check_not_empty() {
+ local name="${1:?}"
+ local value
+ eval value=\$$name
+ if [ -z "$value" ]; then
+ echo "Error: ENV variable should be defined: $1.
+ Please check rabbitmq-env, rabbitmq-defaults, and ${RABBITMQ_CONF_ENV_FILE} script files"
+ exit 78
+ fi
+}
+
+if [ "$RABBITMQ_ALLOW_INPUT" -o "$RUNNING_UNDER_SYSTEMD" -o "$detached" ]; then
+ # Run erlang VM directly, completely replacing current shell
+ # process - so the pid file written in the code above will be
+ # valid (unless detached, which is also handled in the code
+ # above).
+ #
+ # And also this is the correct mode to run the broker under
+ # systemd - there is no need in a proxy process that converts
+ # signals to graceful shutdown command, the unit file should already
+ # contain instructions for graceful shutdown. Also by removing
+ # this additional process we could simply use value returned by
+ # `os:getpid/0` for a systemd ready notification.
+ start_rabbitmq_server "$@"
+else
# When RabbitMQ runs in the foreground but the Erlang shell is
# disabled, we setup signal handlers to stop RabbitMQ properly. This
# is at least useful in the case of Docker.
@@ -160,7 +214,7 @@ if [ 'x' = "x$RABBITMQ_ALLOW_INPUT" -a -z "$detached" ]; then
RABBITMQ_SERVER_START_ARGS="${RABBITMQ_SERVER_START_ARGS} +B i"
# Signal handlers. They all stop RabbitMQ properly (using
- # rabbitmqctl stop). Depending on the signal, this script will exwit
+ # rabbitmqctl stop). Depending on the signal, this script will exit
# with a non-zero error code:
# SIGHUP SIGTERM SIGTSTP
# They are considered a normal process termination, so the script
@@ -176,6 +230,4 @@ if [ 'x' = "x$RABBITMQ_ALLOW_INPUT" -a -z "$detached" ]; then
# Block until RabbitMQ exits or a signal is caught.
# Waits for last command (which is start_rabbitmq_server)
wait $!
-else
- start_rabbitmq_server "$@"
fi
diff --git a/scripts/rabbitmq-server-ha.ocf b/scripts/rabbitmq-server-ha.ocf
index 16fba44290..301f7a1fc7 100755
--- a/scripts/rabbitmq-server-ha.ocf
+++ b/scripts/rabbitmq-server-ha.ocf
@@ -13,8 +13,8 @@
#
# See usage() function below for more details ...
#
-# Note that the script uses set_rabbitmq_policy.sh script located in the
-# same directory to setup RabbitMQ policies.
+# Note that the script uses an external file to setup RabbitMQ policies
+# so make sure to create it from an example shipped with the package.
#
#######################################################################
# Initialization:
@@ -46,6 +46,7 @@ OCF_RESKEY_erlang_cookie_file_default="/var/lib/rabbitmq/.erlang.cookie"
OCF_RESKEY_use_fqdn_default=false
OCF_RESKEY_fqdn_prefix_default=""
OCF_RESKEY_max_rabbitmqctl_timeouts_default=3
+OCF_RESKEY_policy_file_default="/usr/local/sbin/set_rabbitmq_policy"
: ${HA_LOGTAG="lrmd"}
: ${HA_LOGFACILITY="daemon"}
@@ -66,6 +67,7 @@ OCF_RESKEY_max_rabbitmqctl_timeouts_default=3
: ${OCF_RESKEY_use_fqdn=${OCF_RESKEY_use_fqdn_default}}
: ${OCF_RESKEY_fqdn_prefix=${OCF_RESKEY_fqdn_prefix_default}}
: ${OCF_RESKEY_max_rabbitmqctl_timeouts=${OCF_RESKEY_max_rabbitmqctl_timeouts_default}}
+: ${OCF_RESKEY_policy_file=${OCF_RESKEY_policy_file_default}}
#######################################################################
@@ -288,6 +290,14 @@ If too many timeouts happen in a raw, the monitor call will return with error.
<content type="string" default="${OCF_RESKEY_max_rabbitmqctl_timeouts_default}" />
</parameter>
+<parameter name="policy_file" unique="0" required="0">
+<longdesc lang="en">
+A path to the shell script to setup RabbitMQ policies
+</longdesc>
+<shortdesc lang="en">A policy file path</shortdesc>
+<content type="string" default="${OCF_RESKEY_policy_file_default}" />
+</parameter>
+
$EXTENDED_OCF_PARAMS
</parameters>
@@ -613,7 +623,7 @@ rmq_setup_env() {
fi
done
- export LL="${OCF_RESOURCE_INSTANCE}:"
+ export LL="${OCF_RESOURCE_INSTANCE}[$$]:"
update_cookie
}
@@ -668,8 +678,8 @@ reset_mnesia() {
# remove mnesia files, if required
if $make_amnesia ; then
kill_rmq_and_remove_pid
- ocf_run rm -rf "${MNESIA_FILES}/*"
- ocf_log warn "${LH} Mnesia files appear corrupted and have been removed."
+ ocf_run rm -rf "${MNESIA_FILES}"
+ ocf_log warn "${LH} Mnesia files appear corrupted and have been removed from ${MNESIA_FILES}."
fi
# always return OCF SUCCESS
return $OCF_SUCCESS
@@ -1286,6 +1296,7 @@ start_rmq_server_app() {
get_status() {
local what="${1:-kernel}"
local rc=$OCF_NOT_RUNNING
+ local LH="${LL} get_status():"
local body
local beam_running
@@ -1296,11 +1307,11 @@ get_status() {
beam_running=$?
# report not running only if the which_applications() reported an error AND the beam is not running
if [ $rc -ne 0 -a $beam_running -ne 0 ] ; then
- ocf_log info "get_status() failed with code ${rc}. Command output: ${body}"
+ ocf_log info "${LH} failed with code ${rc}. Command output: ${body}"
return $OCF_NOT_RUNNING
# return a generic error, if there were errors and beam is found running
elif [ $rc -ne 0 ] ; then
- ocf_log info "get_status() found the beam process running but failed with code ${rc}. Command output: ${body}"
+ ocf_log info "${LH} found the beam process running but failed with code ${rc}. Command output: ${body}"
return $OCF_ERR_GENERIC
fi
@@ -1310,7 +1321,7 @@ get_status() {
echo "$body" | grep "\{${what}," 2>&1 > /dev/null && rc=$OCF_SUCCESS
if [ $rc -ne $OCF_SUCCESS ] ; then
- ocf_log info "get_status(): app ${what} was not found in command output: ${body}"
+ ocf_log info "${LH} app ${what} was not found in command output: ${body}"
fi
fi
@@ -1347,18 +1358,18 @@ is_master() {
# separately. The second argument is used to distingush them.
check_timeouts() {
local op_rc=$1
- local timeouts_attr_name=$2
+ local crm_attr_name=$2
local op_name=$3
if [ $op_rc -ne 124 -a $op_rc -ne 137 ]; then
- ocf_run attrd_updater -p --name $timeouts_attr_name --update 0
+ ocf_run crm_attribute -N $THIS_PCMK_NODE -l reboot --name $crm_attr_name --update 0
return 0
fi
local count
- count=`attrd_updater --name $timeouts_attr_name --query 2>/dev/null`
+ count=`crm_attribute -N $THIS_PCMK_NODE -l reboot --name $crm_attr_name --query 2>/dev/null`
if [ $? -ne 0 ]; then
- # the attrd_updater exited with error. In that case most probably it printed garbage
+ # the crm_attribute exited with error. In that case most probably it printed garbage
# instead of the number we need. So defensively assume that it is zero.
count=0
@@ -1367,9 +1378,9 @@ check_timeouts() {
count=$((count+1))
# There is a slight chance that this piece of code will be executed twice simultaneously.
- # As a result, $timeouts_attr_name's value will be one less than it should be. But we don't need
+ # As a result, $crm_attr_name's value will be one less than it should be. But we don't need
# precise calculation here.
- ocf_run attrd_updater -p --name $timeouts_attr_name --update $count
+ ocf_run crm_attribute -N $THIS_PCMK_NODE -l reboot --name $crm_attr_name --update $count
if [ $count -lt $OCF_RESKEY_max_rabbitmqctl_timeouts ]; then
ocf_log warn "${LH} 'rabbitmqctl $op_name' timed out $count of max. $OCF_RESKEY_max_rabbitmqctl_timeouts time(s) in a row. Doing nothing for now."
@@ -1468,6 +1479,7 @@ get_monitor() {
if [ -n "$master_name" ]; then
ocf_log info "${LH} master exists and rabbit app is not running. Exiting to be restarted by pacemaker"
+ stop_server_process
rc=$OCF_ERR_GENERIC
fi
fi
@@ -1657,9 +1669,9 @@ action_start() {
return $OCF_SUCCESS
fi
- ocf_run attrd_updater -p --name 'rabbit_list_channels_timeouts' --update '0'
- ocf_run attrd_updater -p --name 'rabbit_get_alarms_timeouts' --update '0'
- ocf_run attrd_updater -p --name 'rabbit_list_queues_timeouts' --update '0'
+ ocf_run crm_attribute -N $THIS_PCMK_NODE -l reboot --name 'rabbit_list_channels_timeouts' --update '0'
+ ocf_run crm_attribute -N $THIS_PCMK_NODE -l reboot --name 'rabbit_get_alarms_timeouts' --update '0'
+ ocf_run crm_attribute -N $THIS_PCMK_NODE -l reboot --name 'rabbit_list_queues_timeouts' --update '0'
ocf_log info "${LH} Deleting start time attribute"
ocf_run crm_attribute -N $THIS_PCMK_NODE -l reboot --name 'rabbit-start-time' --delete
ocf_log info "${LH} Deleting master attribute"
@@ -2097,8 +2109,7 @@ action_promote() {
exit $OCF_FAILED_MASTER
fi
- local set_policy_path="$(dirname $0)/set_rabbitmq_policy.sh"
- [ -f $set_policy_path ] && . $set_policy_path
+ [ -f "${OCF_RESKEY_policy_file}" ] && . "${OCF_RESKEY_policy_file}"
# create timestamp file
nowtime="$(now)"
diff --git a/scripts/rabbitmq-server.bat b/scripts/rabbitmq-server.bat
index d80bb385d5..f014197a39 100644
--- a/scripts/rabbitmq-server.bat
+++ b/scripts/rabbitmq-server.bat
@@ -98,7 +98,18 @@ if "!RABBITMQ_NODE_ONLY!"=="" (
)
if "!RABBITMQ_IO_THREAD_POOL_SIZE!"=="" (
- set RABBITMQ_IO_THREAD_POOL_ARG=30
+ set RABBITMQ_IO_THREAD_POOL_SIZE=64
+)
+
+
+set ENV_OK=true
+CALL :check_not_empty "RABBITMQ_BOOT_MODULE" !RABBITMQ_BOOT_MODULE!
+CALL :check_not_empty "RABBITMQ_NAME_TYPE" !RABBITMQ_NAME_TYPE!
+CALL :check_not_empty "RABBITMQ_NODENAME" !RABBITMQ_NODENAME!
+
+
+if "!ENV_OK!"=="false" (
+ EXIT /b 78
)
"!ERLANG_HOME!\bin\erl.exe" ^
@@ -129,5 +140,16 @@ if "!RABBITMQ_IO_THREAD_POOL_SIZE!"=="" (
!RABBITMQ_DIST_ARG! ^
!STAR!
+EXIT /B 0
+
+:check_not_empty
+if "%~2"=="" (
+ ECHO "Error: ENV variable should be defined: %1. Please check rabbitmq-env and rabbitmq-defaults, and !RABBITMQ_CONF_ENV_FILE! script files. Check also your Environment Variables settings"
+ set ENV_OK=false
+ EXIT /B 78
+ )
+EXIT /B 0
+
endlocal
endlocal
+
diff --git a/scripts/rabbitmq-service.bat b/scripts/rabbitmq-service.bat
index 3d79bba902..b5dd2a5c7b 100644
--- a/scripts/rabbitmq-service.bat
+++ b/scripts/rabbitmq-service.bat
@@ -104,6 +104,16 @@ if not exist "!RABBITMQ_BASE!" (
echo Creating base directory !RABBITMQ_BASE! & md "!RABBITMQ_BASE!"
)
+set ENV_OK=true
+CALL :check_not_empty "RABBITMQ_BOOT_MODULE" !RABBITMQ_BOOT_MODULE!
+CALL :check_not_empty "RABBITMQ_NAME_TYPE" !RABBITMQ_NAME_TYPE!
+CALL :check_not_empty "RABBITMQ_NODENAME" !RABBITMQ_NODENAME!
+
+
+if "!ENV_OK!"=="false" (
+ EXIT /b 78
+)
+
"!ERLANG_SERVICE_MANAGER_PATH!\erlsrv" list !RABBITMQ_SERVICENAME! 2>NUL 1>NUL
if errorlevel 1 (
"!ERLANG_SERVICE_MANAGER_PATH!\erlsrv" add !RABBITMQ_SERVICENAME! -internalservicename !RABBITMQ_SERVICENAME!
@@ -131,6 +141,12 @@ if ERRORLEVEL 3 (
set RABBITMQ_DIST_ARG=-kernel inet_dist_listen_min !RABBITMQ_DIST_PORT! -kernel inet_dist_listen_max !RABBITMQ_DIST_PORT!
)
+ REM Try to create config file, if it doesn't exist
+ REM It still can fail to be created, but at least not for default install
+if not exist "!RABBITMQ_CONFIG_FILE!.config" (
+ echo []. > !RABBITMQ_CONFIG_FILE!.config
+)
+
if exist "!RABBITMQ_CONFIG_FILE!.config" (
set RABBITMQ_CONFIG_ARG=-config "!RABBITMQ_CONFIG_FILE!"
) else (
@@ -150,7 +166,7 @@ if "!RABBITMQ_NODE_ONLY!"=="" (
)
if "!RABBITMQ_IO_THREAD_POOL_SIZE!"=="" (
- set RABBITMQ_IO_THREAD_POOL_SIZE=30
+ set RABBITMQ_IO_THREAD_POOL_SIZE=64
)
if "!RABBITMQ_SERVICE_RESTART!"=="" (
@@ -188,6 +204,8 @@ set ERLANG_SERVICE_ARGUMENTS= ^
set ERLANG_SERVICE_ARGUMENTS=!ERLANG_SERVICE_ARGUMENTS:\=\\!
set ERLANG_SERVICE_ARGUMENTS=!ERLANG_SERVICE_ARGUMENTS:"=\"!
+
+
"!ERLANG_SERVICE_MANAGER_PATH!\erlsrv" set !RABBITMQ_SERVICENAME! ^
-onfail !RABBITMQ_SERVICE_RESTART! ^
-machine "!ERLANG_SERVICE_MANAGER_PATH!\erl.exe" ^
@@ -211,5 +229,15 @@ goto END
:END
+EXIT /B 0
+
+:check_not_empty
+if "%~2"=="" (
+ ECHO "Error: ENV variable should be defined: %1. Please check rabbitmq-env, rabbitmq-default, and !RABBITMQ_CONF_ENV_FILE! script files. Check also your Environment Variables settings"
+ set ENV_OK=false
+ EXIT /B 78
+ )
+EXIT /B 0
+
endlocal
endlocal
diff --git a/scripts/rabbitmqctl b/scripts/rabbitmqctl
index 3705b9a979..2336c3d466 100755
--- a/scripts/rabbitmqctl
+++ b/scripts/rabbitmqctl
@@ -30,7 +30,7 @@ fi
RABBITMQ_USE_LONGNAME=${RABBITMQ_USE_LONGNAME} \
exec ${ERL_DIR}erl \
-pa "${RABBITMQ_HOME}/ebin" \
- -noinput \
+ -noinput +B \
-hidden \
${RABBITMQ_CTL_ERL_ARGS} \
-boot "${CLEAN_BOOT_FILE}" \
diff --git a/scripts/set_rabbitmq_policy.sh b/scripts/set_rabbitmq_policy.sh
deleted file mode 100644
index a88b0c417a..0000000000
--- a/scripts/set_rabbitmq_policy.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-# This script is called by rabbitmq-server-ha.ocf during RabbitMQ
-# cluster start up. It is a convenient place to set your cluster
-# policy here, for example:
-# ${OCF_RESKEY_ctl} set_policy ha-all "." '{"ha-mode":"all", "ha-sync-mode":"automatic"}' --apply-to all --priority 0
-
diff --git a/scripts/travis_test_ocf_ra.sh b/scripts/travis_test_ocf_ra.sh
new file mode 100644
index 0000000000..e8f9a74194
--- /dev/null
+++ b/scripts/travis_test_ocf_ra.sh
@@ -0,0 +1,30 @@
+#!/bin/sh -eux
+# Prepare and run a smoke test against the RabbitMQ OCF RA only if
+# the scripts/rabbitmq-server-ha.ocf has changes
+if ! git diff HEAD~ --name-only | grep -q scripts/rabbitmq-server-ha.ocf
+then
+ exit 0
+fi
+
+export VAGRANT_VERSION=1.8.1
+export DOCKER_IMAGE=bogdando/rabbitmq-cluster-ocf-wily
+export UPLOAD_METHOD=none
+export DOCKER_MOUNTS="$(pwd)/scripts/rabbitmq-server-ha.ocf:/tmp/rabbitmq-server-ha"
+
+# Install vagrant and requirements
+sudo apt-get install -qq git wget
+wget --no-verbose https://releases.hashicorp.com/vagrant/${VAGRANT_VERSION}/vagrant_${VAGRANT_VERSION}_x86_64.deb
+sudo dpkg -i --force-all ./vagrant_${VAGRANT_VERSION}_x86_64.deb
+vagrant plugin install vagrant-triggers
+
+# Update docker and prepare images
+sudo apt-get update
+sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install --only-upgrade docker-engine
+sudo service docker restart
+docker pull $DOCKER_IMAGE
+
+# Prepare and run a smoke test for a rabbitmq cluster by the OCF RA
+git clone https://github.com/bogdando/rabbitmq-cluster-ocf-vagrant.git
+cd ./rabbitmq-cluster-ocf-vagrant
+vagrant up --provider docker
+docker exec -it n1 /bin/bash /vagrant/vagrant_script/test_rabbitcluster.sh rabbit@n1 rabbit@n2