diff --git a/changelogs/fragments/elasticsearch_plugin-showSTDERRonFailure.yaml b/changelogs/fragments/elasticsearch_plugin-showSTDERRonFailure.yaml new file mode 100644 index 0000000000..9d6696ca79 --- /dev/null +++ b/changelogs/fragments/elasticsearch_plugin-showSTDERRonFailure.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: +- elasticsearch_plugin - Improve error messages and show stderr of elasticsearch commands diff --git a/lib/ansible/modules/database/misc/elasticsearch_plugin.py b/lib/ansible/modules/database/misc/elasticsearch_plugin.py index 614caa7fca..8652c1a00e 100644 --- a/lib/ansible/modules/database/misc/elasticsearch_plugin.py +++ b/lib/ansible/modules/database/misc/elasticsearch_plugin.py @@ -175,7 +175,7 @@ def install_plugin(module, plugin_bin, plugin_name, version, url, proxy_host, pr if rc != 0: reason = parse_error(out) - module.fail_json(msg='Is %s a valid plugin name?' % plugin_name, err=reason) + module.fail_json(msg="Installing plugin '%s' failed: %s" % (plugin_name, reason), err=err) return True, cmd, out, err @@ -192,7 +192,7 @@ def remove_plugin(module, plugin_bin, plugin_name): if rc != 0: reason = parse_error(out) - module.fail_json(msg=reason) + module.fail_json(msg="Removing plugin '%s' failed: %s" % (plugin_name, reason), err=err) return True, cmd, out, err