Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rabbitmq_user can't determine the version of RabbitMQ server #53

Open
EugenFo opened this issue Jan 5, 2021 · 16 comments
Open

rabbitmq_user can't determine the version of RabbitMQ server #53

EugenFo opened this issue Jan 5, 2021 · 16 comments

Comments

@EugenFo
Copy link

EugenFo commented Jan 5, 2021

SUMMARY

I'm trying to create rabbitmq users with the rabbitmq_user module, but this keeps failing with the error message:
Could not determine the version of the RabbitMQ server.
I'm using the Ansible version 2.10.3 and the Rabbitmq Cluster has the version 3.7.13 and Erlang version 21.3.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

rabbitmq_user

ANSIBLE VERSION
ansible 2.10.3
  config file = /home/eugen/.ansible.cfg
  configured module search path = ['/home/eugen/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/eugen/virtualenvironments/ansible2.10/lib/python3.6/site-packages/ansible
  executable location = /home/eugen/virtualenvironments/ansible2.10/bin/ansible
  python version = 3.6.9 (default, Oct  8 2020, 12:12:24) [GCC 8.4.0]
CONFIGURATION
Default configuration
OS / ENVIRONMENT

Host: Mint 19.2
Target: Debian 9 (Docker container)

STEPS TO REPRODUCE

First install the Rabbitmq and Erlang version listed above. Try to create or delete users with the rabbitmq_user module. This will result in a Could not determine the version of the RabbitMQ server. error.
However when you execute rabbitmqctl status on one node you will see the output which also contains the rabbitmq version.

rabbitmqctl status output:

[{pid,7497},
 {running_applications,
     [{rabbitmq_shovel_management,
          "Management extension for the Shovel plugin","3.7.13"},
      {rabbitmq_management,"RabbitMQ Management Console","3.7.13"},
      {rabbitmq_management_agent,"RabbitMQ Management Agent","3.7.13"},
      {rabbitmq_web_dispatch,"RabbitMQ Web Dispatcher","3.7.13"},
      {rabbitmq_shovel,"Data Shovel for RabbitMQ","3.7.13"},
      {rabbit,"RabbitMQ","3.7.13"},
      {sysmon_handler,"Rate-limiting system_monitor event handler","1.1.0"},
      {cowboy,"Small, fast, modern HTTP server.","2.6.1"},
      {amqp_client,"RabbitMQ AMQP Client","3.7.13"},
      {rabbit_common,
          "Modules shared by rabbitmq-server and rabbitmq-erlang-client",
          "3.7.13"},
      {ranch,"Socket acceptor pool for TCP protocols.","1.7.1"},
      {amqp10_client,"AMQP 1.0 client from the RabbitMQ Project","3.7.13"},
      {ssl,"Erlang/OTP SSL application","9.2"},
      {public_key,"Public key infrastructure","1.6.5"},
      {asn1,"The Erlang ASN1 compiler version 5.0.8","5.0.8"},
      {recon,"Diagnostic tools for production use","2.3.6"},
      {cowlib,"Support library for manipulating Web protocols.","2.7.0"},
      {crypto,"CRYPTO","4.4.1"},
      {jsx,"a streaming, evented json parsing toolkit","2.9.0"},
      {os_mon,"CPO  CXC 138 46","2.4.7"},
      {inets,"INETS  CXC 138 49","7.0.6"},
      {amqp10_common,
          "Modules shared by rabbitmq-amqp1.0 and rabbitmq-amqp1.0-client",
          "3.7.13"},
      {mnesia,"MNESIA  CXC 138 12","4.15.6"},
      {xmerl,"XML parser","1.3.19"},
      {lager,"Erlang logging framework","3.6.5"},
      {goldrush,"Erlang event stream processor","0.1.9"},
      {compiler,"ERTS  CXC 138 10","7.3.2"},
      {syntax_tools,"Syntax tools","2.1.7"},
      {sasl,"SASL  CXC 138 11","3.3"},
      {stdlib,"ERTS  CXC 138 10","3.8"},
      {kernel,"ERTS  CXC 138 10","6.3"}]},
 {os,{unix,linux}},
 {erlang_version,
     "Erlang/OTP 21 [erts-10.3] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:128]\n"},
 {memory,
     [{connection_readers,0},
      {connection_writers,0},
      {connection_channels,0},
      {connection_other,2732},
      {queue_procs,0},
      {queue_slave_procs,0},
      {plugins,888476},
      {other_proc,31525764},
      {metrics,207268},
      {mgmt_db,160616},
      {mnesia,78608},
      {other_ets,2931976},
      {binary,136136},
      {msg_index,30080},
      {code,28049863},
      {atom,1172689},
      {other_system,13737952},
      {allocated_unused,15769168},
      {reserved_unallocated,0},
      {strategy,rss},
      {total,[{erlang,78922160},{rss,85061632},{allocated,94691328}]}]},
 {alarms,[]},
 {listeners,
     [{clustering,25672,"::"},{amqp,5672,"172.17.0.2"},{http,15672,"::"}]},
 {vm_memory_calculation_strategy,rss},
 {vm_memory_high_watermark,0.4},
 {vm_memory_limit,6548978073},
 {disk_free_limit,50000000},
 {disk_free,182969389056},
 {file_descriptors,
     [{total_limit,32668},
      {total_used,2},
      {sockets_limit,29399},
      {sockets_used,0}]},
 {processes,[{limit,1048576},{used,401}]},
 {run_queue,1},
 {uptime,150},
 {kernel,{net_ticktime,60}}]
EXPECTED RESULTS

Users should be created or deleted.

ACTUAL RESULTS

See above.


@EugenFo
Copy link
Author

EugenFo commented Jan 5, 2021

As an addition: When running the same task with ansible version 2.7.10 everything works like it should.

@walidsa3d
Copy link

Same here

@tlb1galaxy
Copy link

Environment:
OS = CentOS 8
ansible 2.9.17
config file = /etc/ansible/ansible.cfg
configured module search path = ['/var/lib/awx/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.6/site-packages/ansible
executable location = /usr/bin/ansible
python version = 3.6.8 (default, Aug 24 2020, 17:57:11) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]
AWX = 17.0.1
Docker = 20.10.2 build 2291f61
Erlang = 23[erts-11.1.5]
RabbitMQ = 3.7.9
ansible_python_interpreter = auto (set globally)
AnsibleControler:
python = 3.6.8 (alternatives: python->auto->/usr/libexec/no-python, python3->auto->/usr/bin/python3.6)
Targetserver:
CentOS 7 (fresh install with latest updates)
python = 2.7.5 & 3.6.8

1st pass workbook:
summary:
The playbook will finish and Ansible output says it changed (RabbitMQ user accounts and the created the queue/exchange bindings.
results:
When checking the target server, nothing has changed. no additional user accounts created or queue/exchange bindings created.
rabbitmq_cluster_1st_pass.txt

2nd pass workbook: (same workbook no changes and did not reset the target machine to initial state):
summary:
The playbook fails on the first tasks that calls community.rabbitmq.rabbitmq_users with "can't determine the version of RabbitMQ server".
rabbitmq_cluster_2nd_pass.txt

Attempted fixes:

  1. Change ansible_python_interpreter = /usr/bin/python3 at playbook and host level
  2. Change target system alternatives within playbook to set/unset alternatives before the module is called
#- name: set_alternatives_python2_CentOS7
#  shell: update-alternatives --install /usr/bin/python python /usr/bin/python2 20
#  when:
#    - ansible_facts['distribution'] == "CentOS"
#    - ansible_facts['distribution_major_version'] == "7"
  # Required for bug in rabbitmq_user module with Ansible 2.9+

#- name: set_alternatives_python3_CentOS7
#  shell: update-alternatives --install /usr/bin/python python /usr/bin/python3 40
#  when:
#    - ansible_facts['distribution'] == "CentOS"
#    - ansible_facts['distribution_major_version'] == "7"
  # Required for bug in rabbitmq_user module with Ansible 2.9+

#- name: set_alternatives_python_auto_CentOS7
#  shell: alternatives --auto python
#  when:
#    - ansible_facts['distribution'] == "CentOS"
#    - ansible_facts['distribution_major_version'] == "7"
  # Required for bug in rabbitmq_user module with Ansible 2.9+

@tlb1galaxy
Copy link

Forgot to attach the testserver01 Rabbitmq log.
You can see where it registers the commands to create users but not on the system.

testserver01_rabbitmqLog.txt

Testserver01 output:
list_users:

@testserver01 ~]# rabbitmqctl list_users
Listing users ...
user    tags
guest   [administrator]

queues:

testserver01 ~]# rabbitmqadmin --username=guest list exchanges name durable vhost type auto_delete
+--------------------+---------+-------+---------+-------------+
|        name        | durable | vhost |  type   | auto_delete |
+--------------------+---------+-------+---------+-------------+
|                    | True    | /     | direct  | False       |
| amq.direct         | True    | /     | direct  | False       |
| amq.fanout         | True    | /     | fanout  | False       |
| amq.headers        | True    | /     | headers | False       |
| amq.match          | True    | /     | headers | False       |
| amq.rabbitmq.trace | True    | /     | topic   | False       |
| amq.topic          | True    | /     | topic   | False       |
+--------------------+---------+-------+---------+-------------+

RabbitMQ status:

testserver01 ~]# rabbitmqctl status
Status of node [email protected] ...
[{pid,997},
 {running_applications,
     [{rabbitmq_management,"RabbitMQ Management Console","3.7.9"},
      {rabbitmq_management_agent,"RabbitMQ Management Agent","3.7.9"},
      {rabbitmq_web_dispatch,"RabbitMQ Web Dispatcher","3.7.9"},
      {rabbit,"RabbitMQ","3.7.9"},
      {amqp_client,"RabbitMQ AMQP Client","3.7.9"},
      {rabbit_common,
          "Modules shared by rabbitmq-server and rabbitmq-erlang-client",
          "3.7.9"},
      {ranch_proxy_protocol,"Ranch Proxy Protocol Transport","2.1.1"},
      {cowboy,"Small, fast, modern HTTP server.","2.4.0"},
      {ranch,"Socket acceptor pool for TCP protocols.","1.6.2"},
      {ssl,"Erlang/OTP SSL application","10.2"},
      {public_key,"Public key infrastructure","1.9.2"},
      {asn1,"The Erlang ASN1 compiler version 5.0.14","5.0.14"},
      {cowlib,"Support library for manipulating Web protocols.","2.3.0"},
      {mnesia,"MNESIA  CXC 138 12","4.18.1"},
      {os_mon,"CPO  CXC 138 46","2.6.1"},
      {recon,"Diagnostic tools for production use","2.3.6"},
      {jsx,"a streaming, evented json parsing toolkit","2.9.0"},
      {xmerl,"XML parser","1.3.26"},
      {crypto,"CRYPTO","4.8.1"},
      {inets,"INETS  CXC 138 49","7.3.1"},
      {lager,"Erlang logging framework","3.6.5"},
      {goldrush,"Erlang event stream processor","0.1.9"},
      {compiler,"ERTS  CXC 138 10","7.6.6"},
      {syntax_tools,"Syntax tools","2.4"},
      {sasl,"SASL  CXC 138 11","4.0.1"},
      {stdlib,"ERTS  CXC 138 10","3.14"},
      {kernel,"ERTS  CXC 138 10","7.2"}]},
 {os,{unix,linux}},
 {erlang_version,
     "Erlang/OTP 23 [erts-11.1.5] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:64] [hipe]\n"},
 {memory,
     [{connection_readers,0},
      {connection_writers,0},
      {connection_channels,0},
      {connection_other,2820},
      {queue_procs,0},
      {queue_slave_procs,0},
      {plugins,1173868},
      {other_proc,21638892},
      {metrics,206324},
      {mgmt_db,169720},
      {mnesia,76984},
      {other_ets,2852536},
      {binary,85824},
      {msg_index,31248},
      {code,24894092},
      {atom,1278257},
      {other_system,11399131},
      {allocated_unused,4020064},
      {reserved_unallocated,5922816},
      {strategy,rss},
      {total,[{erlang,63809696},{rss,73752576},{allocated,67829760}]}]},
 {alarms,[]},
 {listeners,[{clustering,25672,"::"},{amqp,5672,"::"},{http,15672,"::"}]},
 {vm_memory_calculation_strategy,rss},
 {vm_memory_high_watermark,0.4},
 {vm_memory_limit,1657012224},
 {disk_free_limit,50000000},
 {disk_free,9447653376},
 {file_descriptors,
     [{total_limit,32668},
      {total_used,2},
      {sockets_limit,29399},
      {sockets_used,0}]},
 {processes,[{limit,1048576},{used,388}]},
 {run_queue,1},
 {uptime,904},
 {kernel,{net_ticktime,60}}]

@tlb1galaxy
Copy link

tlb1galaxy commented Jan 29, 2021

Just figured out my issue.
.
On the RabbitMQ server, I set the "rabbitmq-env.conf" option:
USE_LONGNAME=true

This essentially now changes the node name from:
rabbit => rabbit@%fqdn%

So within the rabbitmq_user module, the node option needs to change to match.

- name: rabbitmq_user_add_vmwarerabbit
  community.rabbitmq.rabbitmq_user:
    user: vmwarerabbit
    password: "{{ vault_rabbitmq_vmwarerabbit }}"
    node: "rabbit@{{ ansible_fqdn }}"
    force: yes
    vhost: '/'
    configure_priv: '.*'
    read_priv: '.*'
    write_priv: '.*'
    state: present
    tags: administrator
    update_password: always

Suggestion:
Can the error message be more clear why it fails. Something like
"Node name 'rabbit' not found. Verify full node name"

Also the silent fail on the 1st pass (when the node option is not specified) needs to be a failure.

okassov added a commit to okassov/ansible-role-rabbitmq that referenced this issue Sep 22, 2021
@marc-jan
Copy link

Any update on this issue?

I'm encountering exactly the same issue with up to date ansible version. Workaround with USE_LONGNAME and setting the node in playbook are not working.

@charnet1019
Copy link

same issue.
ansible 2.12.6

@lintyao
Copy link

lintyao commented Jul 13, 2022

For me, adding become: yes solved the issue. I guess it is because the rabbitmqctl command can only be run by root (sudoer) or the rabbitmq user.

@ZimnyakovRS
Copy link

In my case, the problem was that I specified the hostname in uppercase in the inventory. In the module I used the inventory_hostname variable -
"node: "rabbit@{{ inventory_hostname }}" ".
After changing the upper case to the lower case in the hostname in the inventory, the module worked fine.

@Im0
Copy link
Collaborator

Im0 commented Dec 1, 2022

Thanks for your input @ZimnyakovRS

@charnet1019 @marc-jan @walidsa3d @EugenFo - are any of you still experiencing issues with this module or have you found the issue/workaround?

@tlb1galaxy thanks for your suggestions... I'm was just browsing and saw your suggestions. I might take a look at the code and see if anyone implemented or not.

@younishd
Copy link

younishd commented Dec 2, 2022

I started getting this error after having appended my hostname to /etc/hosts as follows:

127.0.0.1 localhost <hostname>

This had the effect that ansible_fqdn would now evaluate to localhost.

Setting the node parameter as follows seems to have fixed the problem for me:

- community.rabbitmq.rabbitmq_user:
    #
    node: "rabbit@{{ ansible_hostname }}"

@Fesenych
Copy link

Is still here.
ansible 2.14.1

@sxmatch
Copy link

sxmatch commented Feb 2, 2023

Any news? Is still here. step: https://docs.openstack.org/kolla-ansible/zed/user/quickstart.html
Ubuntu 22.04.1 LTS ansible [core 2.12.10] kolla-ansible 15.0.1.dev12 OpenStack Zed

(venv) root@ubuntu:~# kolla-ansible -i ./all-in-one deploy

...
...
...
...
...

TASK [nova : Running Nova API bootstrap container] **************************************************************************************************************************
ok: [localhost]

TASK [Bootstrap upgrade] ****************************************************************************************************************************************************
skipping: [localhost]

PLAY [Bootstrap nova cell databases] ****************************************************************************************************************************************

TASK [Bootstrap deploy] *****************************************************************************************************************************************************

TASK [nova-cell : Creating Nova cell database] ******************************************************************************************************************************
changed: [localhost]

TASK [nova-cell : Creating Nova cell database user and setting permissions] *************************************************************************************************
changed: [localhost]

TASK [service-rabbitmq : nova | Ensure RabbitMQ vhosts exist] ***************************************************************************************************************

TASK [service-rabbitmq : nova | Ensure RabbitMQ users exist] ****************************************************************************************************************
FAILED - RETRYING: [localhost]: nova | Ensure RabbitMQ users exist (5 retries left).
FAILED - RETRYING: [localhost]: nova | Ensure RabbitMQ users exist (4 retries left).
FAILED - RETRYING: [localhost]: nova | Ensure RabbitMQ users exist (3 retries left).
FAILED - RETRYING: [localhost]: nova | Ensure RabbitMQ users exist (2 retries left).
FAILED - RETRYING: [localhost]: nova | Ensure RabbitMQ users exist (1 retries left).
failed: [localhost] (item=None) => {"attempts": 5, "censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result", "changed": false}
fatal: [localhost -> {{ service_rabbitmq_delegate_host }}]: FAILED! => {"censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result", "changed": false}

NO MORE HOSTS LEFT **********************************************************************************************************************************************************

PLAY RECAP ******************************************************************************************************************************************************************
localhost                  : ok=155  changed=57   unreachable=0    failed=1    skipped=131  rescued=0    ignored=0   
(venv) root@ubuntu:~# ansible --version
ansible [core 2.12.10]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /path/to/venv/lib/python3.10/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /path/to/venv/bin/ansible
  python version = 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0]
  jinja version = 3.1.2
  libyaml = True
(venv) root@ubuntu:~# cat /etc/os-release 
PRETTY_NAME="Ubuntu 22.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.1 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

kolla-ansible stable/yoga is work for me. https://github.com/openstack/kolla-ansible/tree/46a5776fd7bf4bf6fd627a5e935402d8c21b65eb

same issue too, kolla-ansible 15.1.0, OpenStack master.

chriscroome added a commit to webarch-coop/ansible-role-rabbitmq that referenced this issue Apr 2, 2023
chriscroome added a commit to webarch-coop/ansible-role-rabbitmq that referenced this issue Apr 2, 2023
@winiciusallan
Copy link

Any news? Is still here. step: https://docs.openstack.org/kolla-ansible/zed/user/quickstart.html
Ubuntu 22.04.1 LTS ansible [core 2.12.10] kolla-ansible 15.0.1.dev12 OpenStack Zed

(venv) root@ubuntu:~# kolla-ansible -i ./all-in-one deploy

...
...
...
...
...

TASK [nova : Running Nova API bootstrap container] **************************************************************************************************************************
ok: [localhost]

TASK [Bootstrap upgrade] ****************************************************************************************************************************************************
skipping: [localhost]

PLAY [Bootstrap nova cell databases] ****************************************************************************************************************************************

TASK [Bootstrap deploy] *****************************************************************************************************************************************************

TASK [nova-cell : Creating Nova cell database] ******************************************************************************************************************************
changed: [localhost]

TASK [nova-cell : Creating Nova cell database user and setting permissions] *************************************************************************************************
changed: [localhost]

TASK [service-rabbitmq : nova | Ensure RabbitMQ vhosts exist] ***************************************************************************************************************

TASK [service-rabbitmq : nova | Ensure RabbitMQ users exist] ****************************************************************************************************************
FAILED - RETRYING: [localhost]: nova | Ensure RabbitMQ users exist (5 retries left).
FAILED - RETRYING: [localhost]: nova | Ensure RabbitMQ users exist (4 retries left).
FAILED - RETRYING: [localhost]: nova | Ensure RabbitMQ users exist (3 retries left).
FAILED - RETRYING: [localhost]: nova | Ensure RabbitMQ users exist (2 retries left).
FAILED - RETRYING: [localhost]: nova | Ensure RabbitMQ users exist (1 retries left).
failed: [localhost] (item=None) => {"attempts": 5, "censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result", "changed": false}
fatal: [localhost -> {{ service_rabbitmq_delegate_host }}]: FAILED! => {"censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result", "changed": false}

NO MORE HOSTS LEFT **********************************************************************************************************************************************************

PLAY RECAP ******************************************************************************************************************************************************************
localhost                  : ok=155  changed=57   unreachable=0    failed=1    skipped=131  rescued=0    ignored=0   
(venv) root@ubuntu:~# ansible --version
ansible [core 2.12.10]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /path/to/venv/lib/python3.10/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /path/to/venv/bin/ansible
  python version = 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0]
  jinja version = 3.1.2
  libyaml = True
(venv) root@ubuntu:~# cat /etc/os-release 
PRETTY_NAME="Ubuntu 22.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.1 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

kolla-ansible stable/yoga is work for me. https://github.com/openstack/kolla-ansible/tree/46a5776fd7bf4bf6fd627a5e935402d8c21b65eb

same issue too, kolla-ansible 15.1.0, OpenStack master.

Hi, have you found any solution? I have the same problem.

I'm using
Openstack Zed release
Ubuntu 22.04
kolla-ansible 15.2.1
ansible 2.13.11
rabbitmq 3.10.25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

13 participants