opensearch-project / ansible-playbook

🤖 A community repository for Ansible Playbook of OpenSearch Project.
https://opensearch.org/
Apache License 2.0
87 stars 96 forks source link

[BUG] opensearch.yml: Failure if curl not available #124

Closed heiderich closed 1 year ago

heiderich commented 1 year ago

Describe the bug

If curl is not available, the task Check the opensearch status fails with the error

TASK [linux/opensearch : Check the opensearch status] *************************************************************************
[WARNING]: Consider using the get_url or uri module rather than running 'curl'.  If you need to use command because get_url or
uri is insufficient you can add 'warn: false' to this command task or set 'command_warnings=False' in ansible.cfg to get rid
of this message.
fatal: [os1]: FAILED! => {"changed": false, "cmd": "curl 'https://os1:9200/_cluster/health?pretty' -u 'admin:********@123' -k", "msg": "[Errno 2] No such file or directory: b'curl'", "rc": 2}
...

To Reproduce Steps to reproduce the behavior:

  1. Provide machines without curl installed
  2. Execute the playbook opensearch.yml using ansible-playbook -i inventories/opensearch/hosts opensearch.yml --extra-vars "admin_password=Test@123 kibanaserver_password=Test@6789" --become
  3. See the above error

Expected behavior No error.

Playbook Name opensearch.yml

Host/Environment (please complete the following information):

Additional context As already indicated in the error message, using the uri module would be preferred over calling the external command curl. I guess https://github.com/heiderich/ansible-playbook/commit/b41ae14115e7ffaa691e25e5db2738ec6550000e will resolve this issue. However currently I cannot completely test it due to another issue.

Independently of this issue it would be a good idea to validate the certs. But I consider this a separate issue.

Divyaasm commented 1 year ago

Hey @heiderich, please feel free to raise the PR.

heiderich commented 1 year ago

@Divyaasm see #129. Could you review it?