RabbitMQ Hostname Mismatch

862 views
Skip to first unread message

muha...@swordfish.co.za

unread,
Jun 19, 2018, 3:26:42 PM6/19/18
to Ansible Project
Farily new to ansible, so apologies if I'm missing something obvious.

Ansible version: 2.5.5

Issue: My task throws a hostname mismatch error when adding a new vhost on a server that contains a fresh installation of rabbitMQ:

- name: Ensure RabbitMQ virtual host exists
  rabbitmq_vhost:
    name: "{{ item.name|slugify }}"
    state: present
  when: inventory_hostname in groups['db-servers']


Error description:

fatal: [my-server-address]: FAILED! => {"changed": false, "cmd": "/usr/sbin/rabbitmqctl -q -n rabbit list_vhosts name tracing", "msg": "Error:********@localhost'
- home dir: /var/lib/rabbitmq
- cookie hash: pD9UkaDbh5qROT8GfbNTrA==",
"rc": 69, "stderr": "Error: unable to connect to node rabbit@localhost: nodedown

DIAGNOSTICS
===========

attempted to contact: [rabbit@localhost]
rabbit@localhost:
* connected to epmd (port 4369) on localhost
* epmd reports node 'rabbit' running on port 25672\n  * TCP connection succeeded but Erlang distribution failed
* Hostname mismatch: node \"rabbit@db1\" believes its host is different. Please ensure that hostnames resolve the same way locally and on \"rabbit@db1\"


current node details:
- node name: 'rabbitmq-cli-74@localhost'\n
- home dir: /var/lib/rabbitmq\n
- cookie hash: pD9UkaDbh5qROT8GfbNTrA==\n\n
", "stderr_lines": ["Error: unable to connect to node rabbit@localhost: nodedown", "", "DIAGNOSTICS", "===========", "", "attempted to contact: [rabbit@localhost]", "", "rabbit@localhost:", "  * connected to epmd (port 4369) on localhost"
* epmd reports node 'rabbit' running on port 25672", "  * TCP connection succeeded but Erlang distribution failed", "", "  * Hostname mismatch: node \"rabbit@db1\" believes its host is different. Please ensure that hostnames resolve the same way locally and on \"rabbit@db1\"", "", "", "current node details:", "- node name: 'rabbitmq-cli-74@localhost'", "- home dir: /var/lib/rabbitmq", "- cookie hash: pD9UkaDbh5qROT8GfbNTrA==", ""], "stdout": "", "stdout_lines": []}



I'm not sure where I've gone wrong, but it seems like rabbit@localhost and rabbit@db-1 (where db-1 is my hostname) don't seem to match. I've managed to get around it by forcing the node name to include the correct hostname:

- name: Ensure RabbitMQ virtual host exists
  rabbitmq_vhost:
    name: "{{ item.name|slugify }}"
    node: "rabbit@{{ ansible_hostname }}"
    state: present



Tony Chia

unread,
Jun 19, 2018, 5:06:23 PM6/19/18
to Ansible Project
Is SSL enabled on the rabbitmq server? 

muha...@swordfish.co.za

unread,
Jun 19, 2018, 5:14:15 PM6/19/18
to Ansible Project
It's a stock standard Ubuntu 18.04 server, all I did was install rabbitmq-server via apt. I have not changed any of the config files, so I'm assuming SSL is disabled by default.
Message has been deleted

Pcis

unread,
Jan 31, 2019, 6:33:02 AM1/31/19
to Ansible Project
Did you manage to fix this issue, I'm having the same problem
Reply all
Reply to author
Forward
0 new messages