<commit_before>---
- name: Install JRE
  yum: pkg=jre state=installed

- name: Add Elasticsearch GPG key.
  rpm_key:
    key: http://packages.elasticsearch.org/GPG-KEY-elasticsearch
    state: present

- name: Add Elasticsearch repository.
  copy:
    src: elasticsearch.repo
    dest: /etc/yum.repos.d/elasticsearch.repo
    mode: 0644
  when: elasticsearch_version == 2

- name: Add Elasticsearch repository (for version >= 5).
  template:
    src: elasticsearch.repo.j2
    dest: /etc/yum.repos.d/elasticsearch.repo
    mode: 0644
  when: elasticsearch_version >= 5

- name: Install Elasticsearch.
  yum: pkg=elasticsearch state=installed

- name: Removing Plugins if they exist
  action: >
    shell bin/plugin remove {{ item.shortname }}
    chdir={{ elasticsearch_config.home_dir }}
  with_items: "{{ elasticsearch_plugins }}"
  ignore_errors: yes

- name: Installing Plugins
  action: >
    shell bin/plugin install {{ item.name }}
    chdir={{ elasticsearch_config.home_dir }}
  with_items: "{{ elasticsearch_plugins }}"
  ignore_errors: yes

- name: Configure Elasticsearch.
  lineinfile: >
    dest=/etc/elasticsearch/elasticsearch.yml
    regexp="{{ item.regexp }}"
    line="{{ item.line }}"
    state=present
  with_items:
    - { regexp: 'network\.host', line: 'network.host: 0.0.0.0' }<commit_msg>ES plugin binary name depending on ES version<commit_after>---
- name: Install JRE
  yum: pkg=jre state=installed

- name: Add Elasticsearch GPG key.
  rpm_key:
    key: http://packages.elasticsearch.org/GPG-KEY-elasticsearch
    state: present

- name: Add Elasticsearch repository.
  copy:
    src: elasticsearch.repo
    dest: /etc/yum.repos.d/elasticsearch.repo
    mode: 0644
  when: elasticsearch_version == 2

- name: Add Elasticsearch repository (for version >= 5).
  template:
    src: elasticsearch.repo.j2
    dest: /etc/yum.repos.d/elasticsearch.repo
    mode: 0644
  when: elasticsearch_version >= 5

- name: Install Elasticsearch.
  yum: pkg=elasticsearch state=installed

- name: Set Elasticsearch plugin binary name depending on ES version
  set_fact:
    plugin_bin_name: "{{ 'plugin' if elasticsearch_version < 6 else 'elasticsearch-plugin' }}"

- name: Removing Plugins if they exist
  action: >
    shell bin/{{ es_plugin_bin_name }} remove {{ item.shortname }}
    chdir={{ elasticsearch_config.home_dir }}
  with_items: "{{ elasticsearch_plugins }}"
  ignore_errors: yes

- name: Installing Plugins
  action: >
    shell bin/{{ es_plugin_bin_name }} install {{ item.name }}
    chdir={{ elasticsearch_config.home_dir }}
  with_items: "{{ elasticsearch_plugins }}"
  ignore_errors: yes

- name: Configure Elasticsearch.
  lineinfile: >
    dest=/etc/elasticsearch/elasticsearch.yml
    regexp="{{ item.regexp }}"
    line="{{ item.line }}"
    state=present
  with_items:
    - { regexp: 'network\.host', line: 'network.host: 0.0.0.0' }
{'fraction_non_alphanumeric': 0.12199372603694666, 'fraction_numerical': 0.011502265597769257, 'mean_word_length': 3.592, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '517371', 'n_tokens_mistral': 954, 'n_tokens_neox': 942, 'n_words': 229}