# Need help running Ansible Playbook to install Elastic Search

**URL:** <https://discuss.elastic.co/t/need-help-running-ansible-playbook-to-install-elastic-search/146238>\
**Category:** Elasticsearch\
**Created:** [August 27, 2018, 8:01pm UTC](https://discuss.elastic.co/t/need-help-running-ansible-playbook-to-install-elastic-search/146238 "2018-08-27T20:01:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shahzeb\_Siddiqui](https://avatars.discourse-cdn.com/v4/letter/s/f475e1/32.png) [@Shahzeb\_Siddiqui](https://discuss.elastic.co/u/Shahzeb_Siddiqui)\
**Post date:** [August 27, 2018, 8:01pm UTC](https://discuss.elastic.co/t/need-help-running-ansible-playbook-to-install-elastic-search/146238/1 "2018-08-27T20:01:48Z")

</div>

Looking at [https://github.com/elastic/ansible-elasticsearch](https://github.com/elastic/ansible-elasticsearch) I am trying to install elastic search.

I have run command

**ansible-galaxy install elastic.elasticsearch**

Now I have the following file, I added the two parameters **es\_api\_basic\_auth\_username** and **es\_api\_basic\_auth\_password** and now trying to run the playbook.

[siddis14@adwnode1 ~]$ cat elastic.yml

- name: Elasticsearch with custom configuration  
hosts: localhost  
roles:
  - role: elastic.elasticsearch  
vars:  
es\_instance\_name: "node1"  
es\_data\_dirs:
    - "/opt/elasticsearch/data"  
es\_log\_dir: "/opt/elasticsearch/logs"  
es\_config:  
node.name: "node1"  
cluster.name: "custom-cluster"  
discovery.zen.ping.unicast.hosts: "localhost:9301"  
http.port: 9201  
transport.tcp.port: 9301  
node.data: false  
node.master: true  
bootstrap.memory\_lock: true  
es\_scripts: false  
es\_templates: false  
es\_version\_lock: false  
es\_heap\_size: 1g  
es\_start\_service: false  
es\_plugins\_reinstall: false  
es\_api\_port: 9201  
es\_plugins:
    - plugin: ingest-geoip  
proxy\_host: [proxy.example.com](http://proxy.example.com)  
proxy\_port: 8080  
es\_api\_basic\_auth\_username: elastic  
es\_api\_basic\_auth\_password: elastic

when I run this I get stuck on a task error. I dont know what to do at this point

TASK [elastic.elasticsearch : RedHat - Ensure Java is installed] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [localhost]: FAILED! =\> {"changed": false, "msg": "The Python 2 bindings for rpm are needed for this module. If you require Python 3 support use the `dnf` Ansible module instead.. The Python 2 yum module is needed for this module. If you require Python 3 support use the `dnf` Ansible module instead."}  
to retry, use: --limit @/home/siddis14/elastic.retry

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
localhost : ok=14 changed=0 unreachable=0 failed=1

---

<div class="post-metadata">

**Author:** ![Shahzeb\_Siddiqui](https://avatars.discourse-cdn.com/v4/letter/s/f475e1/32.png) [@Shahzeb\_Siddiqui](https://discuss.elastic.co/u/Shahzeb_Siddiqui)\
**Post date:** [August 27, 2018, 8:22pm UTC](https://discuss.elastic.co/t/need-help-running-ansible-playbook-to-install-elastic-search/146238/2 "2018-08-27T20:22:24Z")

</div>

I was able to get further in the installation by adding **hosts: es\_master**

Now I am getting a weird path error for java during check which doesnt make sense

TASK [elastic.elasticsearch : correct java version selected] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [[adwnode1.pfizer.com](http://adwnode1.pfizer.com)]: FAILED! =\> {"changed": false, "msg": "Specified path /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.131-2.b11.el7\_3.x86\_64/jre/bin/java\n/usr/lib/jvm/java-1.8.0-oracle-1.8.0.131-1jpp.1.el7\_3.x86\_64/jre/bin/java does not exist"}  
to retry, use: --limit @/home/siddis14/elastic.retry

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
[adwnode1.pfizer.com](http://adwnode1.pfizer.com) : ok=16 changed=0 unreachable=0 failed=1

Looking at the path I have these files installed via rpms

[siddis14@adwnode1 ~]$ ls -l /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.131-2.b11.el7\_3.x86\_64/jre/bin/java  
-rwxr-xr-x 1 root root 7336 Apr 13 2017 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.131-2.b11.el7\_3.x86\_64/jre/bin/java

[siddis14@adwnode1 ~]$ ls -l /usr/lib/jvm/java-1.8.0-oracle-1.8.0.131-1jpp.1.el7\_3.x86\_64/jre/bin/java  
-rwxr-xr-x 1 root root 7734 Apr 6 2017 /usr/lib/jvm/java-1.8.0-oracle-1.8.0.131-1jpp.1.el7\_3.x86\_64/jre/bin/java

These are the rpms installed in my system

[siddis14@adwnode1 ~]$ rpm -qa | grep java-1.8.0  
java-1.8.0-openjdk-devel-1.8.0.131-2.b11.el7\_3.x86\_64  
java-1.8.0-oracle-javafx-1.8.0.131-1jpp.1.el7\_3.x86\_64  
java-1.8.0-openjdk-headless-1.8.0.131-2.b11.el7\_3.x86\_64  
java-1.8.0-oracle-1.8.0.131-1jpp.1.el7\_3.x86\_64  
java-1.8.0-oracle-src-1.8.0.131-1jpp.1.el7\_3.x86\_64  
java-1.8.0-oracle-devel-1.8.0.131-1jpp.1.el7\_3.x86\_64  
java-1.8.0-openjdk-1.8.0.131-2.b11.el7\_3.x86\_64

---

<div class="post-metadata">

**Author:** ![michael.russell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michael.russell/32/27889_2.png) [@michael.russell](https://discuss.elastic.co/u/michael.russell)\
**Post date:** [September 5, 2018, 7:09am UTC](https://discuss.elastic.co/t/need-help-running-ansible-playbook-to-install-elastic-search/146238/3 "2018-09-05T07:09:35Z")

</div>

Hi @Shahzeb_Siddiqui

Looks like you ran into a genuine bug with the ansible playbook which I have fixed in [Only use the first found java version if there are multiple installed by Crazybus · Pull Request #493 · elastic/ansible-elasticsearch · GitHub](https://github.com/elastic/ansible-elasticsearch/pull/493). Thanks for finding and reporting it!

Since it looks like you already have java installed on this machine I think you might want to be disabling the java install from this role. You can do this by setting `es_java_install: false`

Taken from the [additional configuration](https://github.com/elastic/ansible-elasticsearch#additional-configuration) section in the readme.

> - `es_java_install` If set to false, Java will not be installed. (true (default) or false)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 3, 2018, 7:09am UTC](https://discuss.elastic.co/t/need-help-running-ansible-playbook-to-install-elastic-search/146238/4 "2018-10-03T07:09:44Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
