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

Ansible community.rabbitmq can't use RABBITMQ_USE_LONGNAME #109

Open
kost1993 opened this issue Jan 29, 2022 · 1 comment
Open

Ansible community.rabbitmq can't use RABBITMQ_USE_LONGNAME #109

kost1993 opened this issue Jan 29, 2022 · 1 comment

Comments

@kost1993
Copy link

SUMMARY

There is a problem with cluster which uses longnames in rabbitmq cluster. For now there is no possible way to use any play against such clusters. There is no such option in plugins and possible life hacks such as setting remote environment doesn’t work.
For instance: rabbitmqctl can be used in bash with longnames:

sudo RABBITMQ_USE_LONGNAME=true [email protected] rabbitmqctl ...
or
sudo rabbitmqctl --longnames [email protected] ...

But in the rabbitmq_user.py of ansible collection there is no possible way to use such option for longnames.
In definition _exec

def _exec(self, args, check_rc=True):

it can use flag --node but not --longnames.

ISSUE TYPE
  • Bug Report
COMPONENT NAME
rabbitmq_user
rabbitmq_vhost
ANSIBLE VERSION
ansible --version

ansible [core 2.11.6]
  config file = /home/k_ilyasov/ansible.cfg
  configured module search path = ['/home/k_ilyasov/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.9/dist-packages/ansible
  ansible collection location = /home/k_ilyasov/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110]
  jinja version = 3.0.2
  libyaml = True
COLLECTION VERSION
ansible-galaxy collection list community.rabbitmq

# /usr/local/lib/python3.9/dist-packages/ansible_collections
Collection         Version
------------------ -------
community.rabbitmq 1.1.0
CONFIGURATION
Default configuration
OS / ENVIRONMENT

OS: Debian 11

STEPS TO REPRODUCE
- block:
  - name: "delete default user guest"
    community.rabbitmq.rabbitmq_user:
      user: guest
      state: absent
    environment:
      RABBITMQ_USE_LONGNAME: "true"
      RABBITMQ_NODENAME: "{{ rabbitmq_node_name }}"
    vars:
      rabbitmq_node_name: "[email protected]"
EXPECTED RESULTS

Users should be created or deleted.

ACTUAL RESULTS

Playbook failed.

TASK [rabbitmq-server : delete default user guest] *********************************************************************
fatal: [testrmq01]: FAILED! => {"changed": false, "msg": "Could not determine the version of the RabbitMQ server."}
@manuelschneider
Copy link

For me it works as of today:

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 12 (bookworm)
Release:	12
Codename:	bookworm
$ ansible --version
ansible [core 2.14.3]

(from debian repos)

$ ansible-galaxy collection list community.rabbitmq
Collection         Version
------------------ -------
community.rabbitmq 1.3.0 

(not from debian repos, from galaxy, because of login_user)

The only trick that's left, is that you have to set the node explicitely:

    rabbitmq_user:
        node: "rabbit@{{ rabbitmq_nodename }}"

whereby rabbitmq_nodename is some fqdn.

And I specified RABBITMQ_USE_LONGNAME=yes in /etc/rabbitmq/rabbitmq-env.conf

So maybe you want to close this issue?

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

2 participants