Why does an `"[Errno 2] No such file or directory", "rc"` issue occur when Ansible is executed remotely?
The return from ansible is json. Pretty printed:
{
"changed": false,
"cmd": "rabbitmqctl list_vhosts",
"failed": true,
"msg": "[Errno 2] No such file or directory",
"rc": 2
}
You'll note msg
contains "[Errno 2] No such file or directory". Instead rc
is the return (exit) code, '2' in your case, of the command rabbitmqctl list_vhosts
.
In shell (bash/sh/whatever) run rabbitmqctl
. You may not have rabbitmqctl
installed. Or, as EEAA rightfully suggests, it is not in $PATH
. On some distros (Debian/Ubuntu) /usr/sbin
is not included in normal users' path, but it is included for root.