elastic / ansible-elasticsearch

Ansible playbook for Elasticsearch
Other
1.59k stars 857 forks source link

Stop plugin install to fail in check mode #787

Closed tobiashuste closed 3 years ago

tobiashuste commented 3 years ago

In check mode Ansible is actually not going to execute the command from the Install elasticsearch plugins task.

https://github.com/elastic/ansible-elasticsearch/blob/4f01bc74a079c726a5045bed5595273fbe2d2bc0/tasks/elasticsearch-plugins.yml#L66-L80

Thus, the rc parameter is not set resulting in a failed execution. My suggestion would be to default the parameter to 0, if it is not set. This allows the role to be run in check mode as well.

Alternative solution

Alternatively, it would be possible to add

ignore_errors: "{{ ansible_check_mode }}"

to the task. But I thought the submitted solution might be cleaner.

Closes #786

elasticmachine commented 3 years ago

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

elasticmachine commented 3 years ago

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

cla-checker-service[bot] commented 3 years ago

💚 CLA has been signed

jmlrt commented 3 years ago

cla/check

jmlrt commented 3 years ago

jenkins test this please

jmlrt commented 3 years ago

Hi @tobiashuste, Thanks for your PR. Can you sign the CLA: https://www.elastic.co/contributor-agreement

tobiashuste commented 3 years ago

@jmlrt Thanks, I just signed the CLA. I hope, it's all fine with it.

jmlrt commented 3 years ago

jenkins test this please