From bf5da3b7fa355b79b9a17521a88309f872f23d88 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Tue, 30 Nov 2021 21:10:18 +0200 Subject: [PATCH] Allow to provide policy state It might be desired by deployer to remove already applied policy. For that policy state should be explicitly passeda as absent for the module. Change-Id: I24bb110998eef978daf618964c1ee3713eb6b339 --- defaults/main.yml | 6 ++++++ tasks/rabbitmq_post_install.yml | 1 + 2 files changed, 7 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index 779bf097..798b44e9 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -261,6 +261,12 @@ rabbitmq_disable_non_tls_listeners: False # pattern: '^(event|metering|notifications)\.' # tags: "ha-sync-mode=automatic" # priority: 0 +# state:present +# If policy needs to be removed, provide `state: absent` +# - name: "HA" +# pattern: '^(?!(amq\.)|(.*_fanout_)|(reply_)).*' +# tags: "ha-mode=all" +# state: absent # rabbitmq_policies: [] rabbitmq_apply_openstack_policies: False diff --git a/tasks/rabbitmq_post_install.yml b/tasks/rabbitmq_post_install.yml index 40145d1d..29435cba 100644 --- a/tasks/rabbitmq_post_install.yml +++ b/tasks/rabbitmq_post_install.yml @@ -88,6 +88,7 @@ name: "{{ item.name }}" pattern: "{{ item.pattern }}" priority: "{{ item.priority | default(0) }}" + state: "{{ item.state | default(omit) }}" tags: "{{ item.tags }}" register: rabbitmq_policy loop: "{{ (rabbitmq_apply_openstack_policies | bool) | ternary(rabbitmq_openstack_policies + rabbitmq_policies, rabbitmq_policies) }}"