Need help running Ansible Playbook to install Elastic Search

Looking at 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
        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

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]: 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 : 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

Hi @Shahzeb_Siddiqui

Looks like you ran into a genuine bug with the ansible playbook which I have fixed in 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 section in the readme.

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

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