-
Notifications
You must be signed in to change notification settings - Fork 52
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
community.rabbitmq.rabbitmq_user - For Remote URL, Username/Password #152
Comments
Hello @mohammedazfar-sanuk , I wasn't quite sure what you were trying to do. Which options were missing? Did you see https://docs.ansible.com/ansible/latest/collections/community/rabbitmq/rabbitmq_user_module.html ? What would you like to see in that documentation? Is there missing functionality? |
@Im0 - thanks for your comments, if you the https://docs.ansible.com/ansible/latest/collections/community/rabbitmq/rabbitmq_user_module.html there is no option to specify the remote rabbitmq URL, is there any option is there ? |
means its missing login_host, login_port, loging_protocol |
Some of the modules uses rabbitmqctl (such as rabbitmq_user, which seems to connect locally only) Some other uses HTTP API (such as rabbitmq_binding), and in those you can specify remote rabbitmq endpoints. # https://github.com/ansible-collections/community.rabbitmq/blob/146b006de99112e1abb5c2be0c4f2bcc8d6c3a5f/plugins/modules/rabbitmq_user.py#L285-L312
def _exec(self, args, check_rc=True):
"""Execute a command using the `rabbitmqctl` utility.
By default the _exec call will cause the module to fail, if the error code is non-zero. If the `check_rc`
flag is set to False, then the exit_code, stdout and stderr will be returned to the calling function to
perform whatever error handling it needs.
:param args: the arguments to pass to the `rabbitmqctl` utility
:param check_rc: when set to True, fail if the utility's exit code is non-zero
:return: the output of the command or all the outputs plus the error code in case of error
"""
cmd = [self._rabbitmqctl, '-q']
if self.node:
cmd.extend(['-n', self.node])
rc, out, err = self.module.run_command(cmd + args)
if check_rc and rc != 0:
# check_rc is not passed to the `run_command` method directly to allow for more fine grained checking of
# error messages returned by `rabbitmqctl`.
user_error_msg_regex = r"(Only root or .* .* run rabbitmqctl)"
user_error_msg = re.search(user_error_msg_regex, out)
if user_error_msg:
self.module.fail_json(msg="Wrong user used to run the `rabbitmqctl` utility: {err}"
.format(err=user_error_msg.group(1)))
else:
self.module.fail_json(msg="rabbitmqctl exited with non-zero code: {err}".format(err=err),
rc=rc, stdout=out)
return out if check_rc else (rc, out, err) |
We have a similar issue; we use a SaaS solution for RabbitMQ (via CloudAMQP) and we currently cannot ie. manage users using this Ansible collection. It would be nice if it would support remote configuration using the Management Plugin and its API. |
I think this is actually a duplicate of #76 |
SUMMARY
To Add user in the Remote Rabbitmq, community.rabbitmq.rabbitmq_user didnt have options need some help.
ISSUE TYPE
COMPONENT NAME
community.rabbitmq.rabbitmq_user
ANSIBLE VERSION
The text was updated successfully, but these errors were encountered: