| 1 |
- block: |
| 2 |
- set_fact: |
| 3 |
plugin_name: rabbitmq_top |
| 4 |
|
| 5 |
- name: Enable plugin [online] |
| 6 |
rabbitmq_plugin: |
| 7 |
name: "{{ plugin_name }}" |
| 8 |
state: enabled |
| 9 |
new_only: True |
| 10 |
register: result |
| 11 |
|
| 12 |
- name: Get rabbitmq-plugins output |
| 13 |
shell: "rabbitmq-plugins list | grep {{ plugin_name }}" |
| 14 |
register: cli_result |
| 15 |
|
| 16 |
- name: Check that the plugin is enabled |
| 17 |
assert: |
| 18 |
that: |
| 19 |
- result is changed |
| 20 |
- result is success |
| 21 |
- '"{{ plugin_name }}" in result.enabled' |
| 22 |
- result.disabled == [] |
| 23 |
- '"[E" in cli_result.stdout' |
| 24 |
|
| 25 |
- name: Enable plugin [online] (idempotency) |
| 26 |
rabbitmq_plugin: |
| 27 |
name: "{{ plugin_name }}" |
| 28 |
state: enabled |
| 29 |
new_only: True |
| 30 |
register: result |
| 31 |
|
| 32 |
- name: Check idempotency |
| 33 |
assert: |
| 34 |
that: |
| 35 |
- result is not changed |
| 36 |
|
| 37 |
- name: Disable plugin [online] |
| 38 |
rabbitmq_plugin: |
| 39 |
name: "{{ plugin_name }}" |
| 40 |
state: disabled |
| 41 |
register: result |
| 42 |
|
| 43 |
- name: Get rabbitmq-plugins output |
| 44 |
shell: "rabbitmq-plugins list | grep {{ plugin_name }}" |
| 45 |
register: cli_result |
| 46 |
|
| 47 |
- name: Check that the plugin is disabled |
| 48 |
assert: |
| 49 |
that: |
| 50 |
- result is changed |
| 51 |
- result is success |
| 52 |
- result.enabled == [] |
| 53 |
- '"{{ plugin_name }}" in result.disabled' |
| 54 |
- '"[E" not in cli_result.stdout' |
| 55 |
|
| 56 |
- name: Disable plugin [online] (idempotency) |
| 57 |
rabbitmq_plugin: |
| 58 |
name: "{{ plugin_name }}" |
| 59 |
state: disabled |
| 60 |
register: result |
| 61 |
|
| 62 |
- name: Check idempotency |
| 63 |
assert: |
| 64 |
that: |
| 65 |
- result is not changed |
| 66 |
|
| 67 |
- name: Enable plugin [offline] |
| 68 |
rabbitmq_plugin: |
| 69 |
name: "{{ plugin_name }}" |
| 70 |
state: enabled |
| 71 |
broker_state: offline |
| 72 |
new_only: True |
| 73 |
register: result |
| 74 |
|
| 75 |
- name: Get rabbitmq-plugins output |
| 76 |
shell: "rabbitmq-plugins list | grep {{ plugin_name }}" |
| 77 |
register: cli_result |
| 78 |
|
| 79 |
- name: Check that the plugin is enabled |
| 80 |
assert: |
| 81 |
that: |
| 82 |
- result is changed |
| 83 |
- result is success |
| 84 |
- '"{{ plugin_name }}" in result.enabled' |
| 85 |
- result.disabled == [] |
| 86 |
- '"[E" in cli_result.stdout' |
| 87 |
|
| 88 |
- name: Enable plugin [offline] (idempotency) |
| 89 |
rabbitmq_plugin: |
| 90 |
name: "{{ plugin_name }}" |
| 91 |
state: enabled |
| 92 |
broker_state: offline |
| 93 |
new_only: True |
| 94 |
register: result |
| 95 |
|
| 96 |
- name: Check idempotency |
| 97 |
assert: |
| 98 |
that: |
| 99 |
- result is not changed |
| 100 |
|
| 101 |
- name: Disable plugin [offline] |
| 102 |
rabbitmq_plugin: |
| 103 |
name: "{{ plugin_name }}" |
| 104 |
state: disabled |
| 105 |
broker_state: offline |
| 106 |
register: result |
| 107 |
|
| 108 |
- name: Get rabbitmq-plugins output |
| 109 |
shell: "rabbitmq-plugins list | grep {{ plugin_name }}" |
| 110 |
register: cli_result |
| 111 |
|
| 112 |
- name: Check that the plugin is disabled |
| 113 |
assert: |
| 114 |
that: |
| 115 |
- result is changed |
| 116 |
- result is success |
| 117 |
- result.enabled == [] |
| 118 |
- '"{{ plugin_name }}" in result.disabled' |
| 119 |
- '"[E" not in cli_result.stdout' |
| 120 |
|
| 121 |
- name: Disable plugin [offline] (idempotency) |
| 122 |
rabbitmq_plugin: |
| 123 |
name: "{{ plugin_name }}" |
| 124 |
state: disabled |
| 125 |
broker_state: offline |
| 126 |
register: result |
| 127 |
|
| 128 |
- name: Check idempotency |
| 129 |
assert: |
| 130 |
that: |
| 131 |
- result is not changed |
| 132 |
|
| 133 |
always: |
| 134 |
- name: Disable plugin |
| 135 |
rabbitmq_plugin: |
| 136 |
name: "{{ plugin_name }}" |
| 137 |
state: disabled |