rabbitmq_user user state=absent error

When I run the task:

  • rabbitmq_user: user=guest state=absent node=srv1

The error:

failed: [v-cep01] => {“changed”: true, “cmd”: "/usr/sbin/rabbitmqctl delete_user guest ", “delta”: “0:00:00.101132”, “end”: “2014-01-30 19:36:40.314277”, “item”: “”, “rc”: 2, “start”: “2014-01-30 19:36:40.213145”}
stderr: Error: no_such_user: guest
stdout: Deleting user “guest” …

If the user doesn’t exist it should just continue on because its already absent. Instead I get an error. If I:

ignore_errors: yes

It still errors out and stops the play.

Any suggestions?

Seems like a logic error in the module. File a bug or submit a pull request with a fix please.

I’ll take a look and see if I can figure out what is going on here.

Excellent, thanks Chris!

What version of ansible are you running? As far as I can tell, the current implementation of the module should handle your situation correctly. The one thing that is odd to me is the command that you are returning, and getting the error on, would never be run in the current implementation of the module.

The module will always inject the command line parameters ‘-q -n ’ for all commands. I am pretty sure the -q has been there forever and the -n was added almost a year ago. This is being excluded from command that you are running. This means a couple of things that I could think of.

  • You have a local library version of the plugin that is overriding the default. The current default global place for these according to the ansible.cfg is /usr/share/ansible but yours could be somewhere else. You could also have a library folder relative to your playbook.
  • The error is actually coming from another task in your playbook. Possibly a command or shell task.
  • You are on a very old version of ansible. I find this unlikely since the -q is not even in your command.

Chris