From 2f6e5036646aca5071925ad7fb40a9a81b198968 Mon Sep 17 00:00:00 2001 From: Jimmy McCrory Date: Fri, 29 Jun 2018 15:26:28 -0700 Subject: [PATCH] Restart after plugins or policies have changed To avoid every run of the role causing a restart of rabbitmq services, move the restart task until after the tasks for configuring plugins and policies so that 'rabbitmq_plugin' and 'rabbitmq_policy' are registered. Change-Id: If7aeeab81a2b8dc722d460b1dba8e65f63285b10 --- tasks/rabbitmq_post_install.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tasks/rabbitmq_post_install.yml b/tasks/rabbitmq_post_install.yml index 1c0230a4..b69bc501 100644 --- a/tasks/rabbitmq_post_install.yml +++ b/tasks/rabbitmq_post_install.yml @@ -24,7 +24,7 @@ - rabbitmq-config - name: Create rabbitmq config - register: rabbit_config_changed + register: rabbit_config template: src: "{{ item.src }}" dest: "{{ item.dest }}" @@ -62,10 +62,6 @@ # don't trigger ANSIBLE0016 - skip_ansible_lint -- include: rabbitmq_restart.yml - static: no - when: rabbit_config_changed|changed or rabbitmq_plugin|changed or rabbitmq_queue_mirror|changed - - name: Configure rabbitmq plugins rabbitmq_plugin: names: "{{ item.name }}" @@ -82,12 +78,16 @@ pattern: "{{ item.pattern }}" priority: "{{ item.priority | default(0) }}" tags: "{{ item.tags }}" - register: rabbitmq_queue_mirror + register: rabbitmq_policy with_items: "{{ rabbitmq_policies }}" tags: - rabbitmq-config - rabbitmq-cluster +- include: rabbitmq_restart.yml + static: no + when: rabbit_config|changed or rabbitmq_plugin|changed or rabbitmq_policy|changed + # This is being done because the rabbitctl command used by the module # is not very effective at returning proper status codes for failure # and the module does not error detection. until we can go upstream