diff --git a/lib/ansible/modules/extras/messaging/rabbitmq_exchange.py b/lib/ansible/modules/extras/messaging/rabbitmq_exchange.py index ac2fee6181..8cd519032d 100644 --- a/lib/ansible/modules/extras/messaging/rabbitmq_exchange.py +++ b/lib/ansible/modules/extras/messaging/rabbitmq_exchange.py @@ -130,7 +130,10 @@ def main(): details = r.text ) - changeRequired = not exchangeExists if module.params['state']=='present' else exchangeExists + if module.params['state']=='present': + changeRequired = not exchangeExists + else: + changeRequired = exchangeExists # Check if attributes change on existing exchange if not changeRequired and r.status_code==200 and module.params['state'] == 'present':