Closed zzhanabek closed 1 year ago
@zzhanabek thank you for reporting and providing a suggested fix. We will look to implement a fix in the next version once validated.
@zzhanabek I've not yet been replicate the issue that you have been seeing. I raised a PR with a bit more debugging output on the integration test and the results appeared as though idempotency worked fine.
The integration tests are visible here: https://github.com/ansible-collections/community.rabbitmq/blob/main/tests/integration/targets/rabbitmq_plugin/tasks/tests.yml Do they look similar to what you're doing in your play? Any suggestions as to how I can reproduce the issue you're seeing?
2022-11-23T03:34:08.6350155Z 01:55 TASK [rabbitmq_plugin : set_fact] **********************************************
2022-11-23T03:34:08.6636798Z 01:55 [0;32mok: [testhost] => {"ansible_facts": {"plugin_name": "rabbitmq_top"}, "changed": false}[0m
2022-11-23T03:34:08.6639048Z 01:55
2022-11-23T03:34:08.6639555Z 01:55 TASK [rabbitmq_plugin : Enable plugin [online]] ********************************
2022-11-23T03:34:13.4593467Z 02:00 [0;33mchanged: [testhost] => {"changed": true, "disabled": [], "enabled": ["rabbitmq_top"]}[0m
2022-11-23T03:34:13.4594111Z 02:00
2022-11-23T03:34:13.4594528Z 02:00 TASK [rabbitmq_plugin : debug] *************************************************
2022-11-23T03:34:13.4901353Z 02:00 [0;32mok: [testhost] => {[0m
2022-11-23T03:34:13.4902099Z 02:00 [0;32m "result": {[0m
2022-11-23T03:34:13.4902831Z 02:00 [0;32m "changed": true,[0m
2022-11-23T03:34:13.4903434Z 02:00 [0;32m "disabled": [],[0m
2022-11-23T03:34:13.4915582Z 02:00 [0;32m "enabled": [[0m
2022-11-23T03:34:13.4916265Z 02:00 [0;32m "rabbitmq_top"[0m
2022-11-23T03:34:13.4916879Z 02:00 [0;32m ],[0m
2022-11-23T03:34:13.4917462Z 02:00 [0;32m "failed": false[0m
2022-11-23T03:34:13.4918030Z 02:00 [0;32m }[0m
2022-11-23T03:34:13.4918558Z 02:00 [0;32m}[0m
2022-11-23T03:34:13.4918861Z 02:00
2022-11-23T03:34:13.4919597Z 02:00 TASK [rabbitmq_plugin : Get rabbitmq-plugins output] ***************************
2022-11-23T03:34:15.5153885Z 02:02 [0;33mchanged: [testhost] => {"changed": true, "cmd": "rabbitmq-plugins list | grep rabbitmq_top", "delta": "0:00:01.857142", "end": "2022-11-23 03:34:15.488368", "msg": "", "rc": 0, "start": "2022-11-23 03:34:13.631226", "stderr": "", "stderr_lines": [], "stdout": "[E*] rabbitmq_top 3.11.3", "stdout_lines": ["[E*] rabbitmq_top 3.11.3"]}[0m
2022-11-23T03:34:15.5155050Z 02:02
2022-11-23T03:34:15.5155486Z 02:02 TASK [rabbitmq_plugin : Check that the plugin is enabled] **********************
2022-11-23T03:34:15.5592738Z 02:02 [0;32mok: [testhost] => {[0m
2022-11-23T03:34:15.5593478Z 02:02 [0;32m "changed": false,[0m
2022-11-23T03:34:15.5594161Z 02:02 [0;32m "msg": "All assertions passed"[0m
2022-11-23T03:34:15.5605199Z 02:02 [0;32m}[0m
2022-11-23T03:34:15.5605528Z 02:02
2022-11-23T03:34:15.5612622Z 02:02 TASK [rabbitmq_plugin : debug] *************************************************
2022-11-23T03:34:15.5915597Z 02:02 [0;32mok: [testhost] => {[0m
2022-11-23T03:34:15.5916456Z 02:02 [0;32m "cli_result": {[0m
2022-11-23T03:34:15.5917130Z 02:02 [0;32m "changed": true,[0m
2022-11-23T03:34:15.5926095Z 02:02 [0;32m "cmd": "rabbitmq-plugins list | grep rabbitmq_top",[0m
2022-11-23T03:34:15.5927233Z 02:02 [0;32m "delta": "0:00:01.857142",[0m
2022-11-23T03:34:15.5927992Z 02:02 [0;32m "end": "2022-11-23 03:34:15.488368",[0m
2022-11-23T03:34:15.5928648Z 02:02 [0;32m "failed": false,[0m
2022-11-23T03:34:15.5929248Z 02:02 [0;32m "msg": "",[0m
2022-11-23T03:34:15.5929820Z 02:02 [0;32m "rc": 0,[0m
2022-11-23T03:34:15.5930505Z 02:02 [0;32m "start": "2022-11-23 03:34:13.631226",[0m
2022-11-23T03:34:15.5931154Z 02:02 [0;32m "stderr": "",[0m
2022-11-23T03:34:15.5932070Z 02:02 [0;32m "stderr_lines": [],[0m
2022-11-23T03:34:15.5932808Z 02:02 [0;32m "stdout": "[E*] rabbitmq_top 3.11.3",[0m
2022-11-23T03:34:15.5933505Z 02:02 [0;32m "stdout_lines": [[0m
2022-11-23T03:34:15.5934182Z 02:02 [0;32m "[E*] rabbitmq_top 3.11.3"[0m
2022-11-23T03:34:15.5934791Z 02:02 [0;32m ][0m
2022-11-23T03:34:15.5935317Z 02:02 [0;32m }[0m
2022-11-23T03:34:15.5935836Z 02:02 [0;32m}[0m
2022-11-23T03:34:15.5936139Z 02:02
2022-11-23T03:34:15.5936574Z 02:02 TASK [rabbitmq_plugin : Enable plugin [online] (idempotency)] ******************
2022-11-23T03:34:17.3567716Z 02:04 [0;32mok: [testhost] => {"changed": false, "disabled": [], "enabled": []}[0m
2022-11-23T03:34:17.3576154Z 02:04
2022-11-23T03:34:17.3576622Z 02:04 TASK [rabbitmq_plugin : debug] *************************************************
2022-11-23T03:34:17.3877300Z 02:04 [0;32mok: [testhost] => {[0m
2022-11-23T03:34:17.3878016Z 02:04 [0;32m "result": {[0m
2022-11-23T03:34:17.3889612Z 02:04 [0;32m "changed": false,[0m
2022-11-23T03:34:17.3890635Z 02:04 [0;32m "disabled": [],[0m
2022-11-23T03:34:17.3899034Z 02:04 [0;32m "enabled": [],[0m
2022-11-23T03:34:17.3899685Z 02:04 [0;32m "failed": false[0m
2022-11-23T03:34:17.3900246Z 02:04 [0;32m }[0m
2022-11-23T03:34:17.3900774Z 02:04 [0;32m}[0m
2022-11-23T03:34:17.3901058Z 02:04
2022-11-23T03:34:17.3901485Z 02:04 TASK [rabbitmq_plugin : Check idempotency] *************************************
2022-11-23T03:34:17.4229189Z 02:04 [0;32mok: [testhost] => {[0m
2022-11-23T03:34:17.4229954Z 02:04 [0;32m "changed": false,[0m
2022-11-23T03:34:17.4230616Z 02:04 [0;32m "msg": "All assertions passed"[0m
2022-11-23T03:34:17.4231195Z 02:04 [0;32m}[0m
Hello!
I could not get any output from community.rabbitmq.rabbitmq_plugin
. I noticed, how binary called and reproduced python code, so by this way I've found: Clustered rabbitmq shows message
Listing plugins with pattern ".*" ...
in output when called via
rabbitmq-plugins list -E -m
, just like in python code
list_output = self._exec(['list', '-E', '-m'], True)
My config, where I found this idempotence fail at plugins installation task
rabbitmq_plugins:
- rabbitmq_management
rabbitmq_env_config: |
USE_LONGNAME=true
rabbitmq_config: |
cluster_name = amqp
cluster_formation.peer_discovery_backend = classic_config
{% for node in groups.amqp %}
cluster_formation.classic_config.nodes.{{ loop.index0 + 1 }} = rabbit@{{ hostvars[node].ansible_nodename }}
{% endfor %}
{% for node in groups.amqp %}
cluster_partition_handling.pause_if_all_down.nodes.{{ loop.index0 + 1 }} = rabbit@{{ hostvars[node].ansible_nodename }}
{% endfor %}
ansible tasks code:
- name: Enable plugins
rabbitmq_plugins:
names: '{{ rabbitmq_plugins | join(",") }}'
state: enabled
when: rabbitmq_plugins | length > 0
@zzhanabek thanks for the additional information. I'm having a hard time identifying why you're seeing this issue and I'm not. I'm wondering if it's playing up due to the clustering... we don't test in the integration testing against a cluster.
Before implementing your suggested fix I would really like to reproduce or understand what's causing the issue.
My plugins list returns this:
# rabbitmq-plugins list -E -m
Listing plugins with pattern ".*" ...
rabbitmq_management
rabbitmq_prometheus
rabbitmq_random_exchange
Is your output exactly the same other than the plugins being enabled? They look the same to me at the moment.
I might have to spin up some containers and setup a cluster to test against. I'm wondering if this is somehow related to #109
@Im0 Hello!
Is your output exactly the same other than the plugins being enabled?
I ran this module and shell command against 3 different environments. Differences in OSes, Rabbitmq version, cluster and standalone modes, plugins. All testing environments showed in output:
Listing plugins with pattern ".*" ...
but version rabbitmq-server-3.7.7-1.el7
showed nothing but actual list.
Idempotence tests failed in a case, where plugins list was mixed with implicitly enabled and explicitly enabled — my bad. Sorry for taking your time, and thank you for trying to help!
@zzhanabek thanks for letting me know. I'll close this issue now but please feel free to re-open if required.
Hello!
I am facing an issue, which is failing idempotence. On this setting:
Code of the failing task:
Everytime this task returns
changed
.In local environment I have fixed this issue by adding
'-s'
in this line: https://github.com/ansible-collections/community.rabbitmq/blob/0a5173b01ac27be81d98d04a86c0a94869cf8408/plugins/modules/rabbitmq_plugin.py#L122How it looks in current state as version
1.2.3
How it will be look like with
'-s'
parameterRegards, Zangar Zhanabek