From 9cc75f1f54cd75fac3d47bc8cbdb8336ca2ebad3 Mon Sep 17 00:00:00 2001
From: Frank Shearar <frank@lshift.net>
Date: Tue, 9 Jul 2013 17:33:14 +0100
Subject: [PATCH] Let someone specify a path to a Rabbit that's not installed
 in the usual place.

---
 messaging/rabbitmq_plugin | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/messaging/rabbitmq_plugin b/messaging/rabbitmq_plugin
index c9a90f31aa6..43ef05f465c 100644
--- a/messaging/rabbitmq_plugin
+++ b/messaging/rabbitmq_plugin
@@ -46,6 +46,11 @@ options:
     required: false
     default: enabled
     choices: [enabled, disabled]
+  path:
+    description:
+      - Specify a custom path to a Rabbit
+    required: false
+    default: null
 '''
 
 EXAMPLES = '''
@@ -56,7 +61,11 @@ EXAMPLES = '''
 class RabbitMqPlugins(object):
     def __init__(self, module):
         self.module = module
-        self._rabbitmq_plugins = module.get_bin_path('rabbitmq-plugins', True)
+
+        if module.params['path']:
+            self._rabbitmq_plugins = module.params['path'] + "/sbin/rabbitmq-plugins"
+        else:
+            self._rabbitmq_plugins = module.get_bin_path('rabbitmq-plugins', True)
 
     def _exec(self, args, run_in_check_mode=False):
         if not self.module.check_mode or (self.module.check_mode and run_in_check_mode):
@@ -78,7 +87,8 @@ def main():
     arg_spec = dict(
         names=dict(required=True, aliases=['name']),
         new_only=dict(default='no', type='bool'),
-        state=dict(default='enabled', choices=['enabled', 'disabled'])
+        state=dict(default='enabled', choices=['enabled', 'disabled']),
+        path=dict(required=False, default=None)
     )
     module = AnsibleModule(
         argument_spec=arg_spec,