geerlingguy / ansible-role-elasticsearch

Ansible Role - Elasticsearch
https://galaxy.ansible.com/geerlingguy/elasticsearch/
MIT License
185 stars 209 forks source link

Support different Elasticsearch versions #37

Closed geerlingguy closed 5 years ago

geerlingguy commented 5 years ago

Currently there's just Elasticsearch 2.x... which is ancient. I want to introduce an elasticsearch_version variable, and make it default to the current major version, 6.x. Should also fix #36.

esseti commented 5 years ago

how can I install 2.4?

gioy commented 5 years ago

Hello, I tried to install elasticsearch 2.x, but it failed with the following message:

TASK [geerlingguy.elasticsearch : Install Elasticsearch.] task path: /etc/ansible/roles/geerlingguy.elasticsearch/tasks/main.yml:8 Using module file /usr/local/lib/python2.7/dist-packages/ansible/modules/packaging/os/apt.py

ESTABLISH LOCAL CONNECTION FOR USER: vagrant EXEC /bin/sh -c 'echo ~ && sleep 0' EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/vagrant/.ansible/tmp/ansible-tmp-1546192520.79-237011690349350 `" && echo ansible-tmp-1546192520.79-237011690349350="` echo /home/vagrant/.ansible/tmp/ansible-tmp-1546192520.79-237011690349350 `" ) && sleep 0' PUT /tmp/tmpJCbsC2 TO /home/vagrant/.ansible/tmp/ansible-tmp-1546192520.79-237011690349350/apt.py EXEC /bin/sh -c 'chmod u+x /home/vagrant/.ansible/tmp/ansible-tmp-1546192520.79-237011690349350/ /home/vagrant/.ansible/tmp/ansible-tmp-1546192520.79-237011690349350/apt.py && sleep 0' EXEC /bin/sh -c 'sudo -H -S -n -u root /bin/sh -c '"'"'echo BECOME-SUCCESS-pmkmivtbjvpkfjltgzzmgziwotlverok; /usr/bin/python /home/vagrant/.ansible/tmp/ansible-tmp-1546192520.79-237011690349350/apt.py; rm -rf "/home/vagrant/.ansible/tmp/ansible-tmp-1546192520.79-237011690349350/" > /dev/null 2>&1'"'"' && sleep 0' The full traceback is: File "/tmp/ansible_O9eckZ/ansible_module_apt.py", line 333, in package_status pkg = cache[pkgname] File "/usr/lib/python2.7/dist-packages/apt/cache.py", line 262, in __getitem__ raise KeyError('The cache has no package named %r' % key) fatal: [myhost]: FAILED! => { "changed": false, "failed": true, "invocation": { "module_args": { "allow_unauthenticated": false, "autoclean": false, "autoremove": false, "cache_valid_time": 0, "deb": null, "default_release": null, "dpkg_options": "force-confdef,force-confold", "force": false, "force_apt_get": false, "install_recommends": null, "name": "elasticsearch", "only_upgrade": false, "package": [ "elasticsearch" ], "purge": false, "state": "present", "update_cache": null, "upgrade": null } }, "msg": "No package matching 'elasticsearch' is available" }

So I checked the current set apt repository and it actually does not have any release for elasticsearch 2.x. Looking for an open issue, I found the following suggested patch: https://github.com/geerlingguy/ansible-role-elasticsearch/issues/26#issuecomment-27268936). I based the following pull request on it: https://github.com/geerlingguy/ansible-role-elasticsearch/pull/43

Thank you for your work.