elastic / ansible-elasticsearch

Ansible playbook for Elasticsearch
Other
1.58k stars 854 forks source link

Role execution fails if started in check mode #786

Closed tobiashuste closed 3 years ago

tobiashuste commented 3 years ago

Elasticsearch version: *

Role version: Tested with latest release 7.11.2 but also appears in previous versions

Description of the problem including expected versus actual behaviour:

Role execution fails in Ansible check mode. It is expected that the role can also be executed fine when run with Ansible check mode activated.
This happens in this task, especially in line 70/78: https://github.com/elastic/ansible-elasticsearch/blob/4f01bc74a079c726a5045bed5595273fbe2d2bc0/tasks/elasticsearch-plugins.yml#L66-L80

Error message:

FAILED! => {"msg": "The conditional check 'plugin_installed.rc == 0' failed. The error was: error while evaluating conditional (plugin_installed.rc == 0): 'dict object' has no attribute 'rc'"}

This is due to the fact, that Ansible does not execute the command in check mode. This is why the registered variable does not have the rc parameter set and thus the role is currently failing when run in check mode.