Ansible 1.8.4 rabbitmq_user ValueError when removing guest user.

Hello All,

I want to use the rabbitmq_user module to remove the default guest user. My task is:

`

  • name: delete rabbitmq guest user
    rabbitmq_user: user=guest state=absent

`

This works the first time around when the guest user exists. However, when running this a second time I get the following error:

Traceback (most recent call last): File "/home/centos/.ansible/tmp/ansible-tmp-1440685310.89-270486972930416/rabbitmq_user", line 1843, in <module> main() File "/home/centos/.ansible/tmp/ansible-tmp-1440685310.89-270486972930416/rabbitmq_user", line 221, in main if rabbitmq_user.get(): File "/home/centos/.ansible/tmp/ansible-tmp-1440685310.89-270486972930416/rabbitmq_user", line 139, in get user, tags = user_tag.split('\t') ValueError: need more than 1 value to unpackEnter code here...

It’s failing on this line: https://github.com/ansible/ansible-modules-extras/blob/devel/messaging/rabbitmq_user.py#L139
This is failing because rabbitmqctl list_users will also return the last login time of the user which does not contain ‘\t’. Since we’re splitting by ‘\t’ we should first check if ‘\t’ exists in the string before splitting.
I’m not sure if this has always been the behavior or has changed but I’m using RabbitMQ version 3.1.5. I can make a PR for this change unless a more elegant solution can be suggested.

Regards,

Mike