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
This commit is contained in:
Jimmy McCrory 2018-06-29 15:26:28 -07:00
parent db4834d9c7
commit 2f6e503664

View File

@ -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