diff options
author | Brad Wilson <dotnetguy@gmail.com> | 2015-11-11 14:42:11 -0800 |
---|---|---|
committer | Brad Wilson <dotnetguy@gmail.com> | 2015-11-11 14:42:11 -0800 |
commit | 3177e9eaf0144a97f5beb61a4edd4cb63f2f62eb (patch) | |
tree | 4b6cb20c80578f483f8bb0a38d573fc2ca8646a0 /messaging | |
parent | 1de3509f3bd6bb61fc074fe41cc21989e7167457 (diff) | |
download | ansible-modules-extras-3177e9eaf0144a97f5beb61a4edd4cb63f2f62eb.tar.gz |
Add apply_to option to rabbitmq_policy
Diffstat (limited to 'messaging')
-rw-r--r-- | messaging/rabbitmq_policy.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/messaging/rabbitmq_policy.py b/messaging/rabbitmq_policy.py index 81d7068e..0a7d023d 100644 --- a/messaging/rabbitmq_policy.py +++ b/messaging/rabbitmq_policy.py @@ -38,6 +38,12 @@ options: - The name of the vhost to apply to. required: false default: / + apply_to: + description: + - What the policy applies to. Requires RabbitMQ 3.2.0 or later. + required: false + default: all + choices: [all, exchanges, queues] pattern: description: - A regex of queues to apply the policy to. @@ -81,6 +87,7 @@ class RabbitMqPolicy(object): self._name = name self._vhost = module.params['vhost'] self._pattern = module.params['pattern'] + self._apply_to = module.params['apply_to'] self._tags = module.params['tags'] self._priority = module.params['priority'] self._node = module.params['node'] @@ -112,6 +119,9 @@ class RabbitMqPolicy(object): args.append(json.dumps(self._tags)) args.append('--priority') args.append(self._priority) + if (self._apply_to != 'all'): + args.append('--apply-to') + args.append(self._apply_to) return self._exec(args) def clear(self): @@ -123,6 +133,7 @@ def main(): name=dict(required=True), vhost=dict(default='/'), pattern=dict(required=True), + apply_to=dict(default='all', choices=['all', 'exchanges', 'queues']), tags=dict(type='dict', required=True), priority=dict(default='0'), node=dict(default='rabbit'), |