<commit_before>---
#
# Install/run kibana
#

- name: Check for epel
  shell: rpm -qa | grep -q epel-release
  ignore_errors: true
  register: epel_installed

- name: Install epel repo
  command: rpm -ivh {{ epel_repo }}
  become: true
  when: epel_installed.rc != 0

- name: Copy kibana yum repo file
  copy:
    src=kibana.repo
    dest=/etc/yum.repos.d/kibana.repo
    owner=root
    group=root
    mode=0644
  become: true

# We need to insert data to create initial an initial index, query if it exists
- name: Query index status
  shell: curl -GET http://localhost:9200/_cat/indices 2>/dev/null | grep yellow | wc -l
  ignore_errors: true
  register: elasticsearch_no_index_present

# Populate with our own logs
- name: Populate elasticsearch index with local logs
  shell: cat /var/log/messages | /opt/logstash/bin/logstash -f /etc/logstash/conf.d/10-syslog.conf
  when: elasticsearch_no_index_present.stdout|int == 1
- name: Install kibana rpms
  yum: name={{ item }} state=present
  become: true
  with_items:<commit_msg>fix elasticsearch index load logic<commit_after>---
#
# Install/run kibana
#

- name: Check for epel
  shell: rpm -qa | grep -q epel-release
  ignore_errors: true
  register: epel_installed

- name: Install epel repo
  command: rpm -ivh {{ epel_repo }}
  become: true
  when: epel_installed.rc != 0

- name: Copy kibana yum repo file
  copy:
    src=kibana.repo
    dest=/etc/yum.repos.d/kibana.repo
    owner=root
    group=root
    mode=0644
  become: true

# We need to insert data to create initial an initial index, query if it exists
- name: Query index status
  shell: curl -GET http://localhost:9200/_cat/indices 2>/dev/null | grep logstash | wc -l
  ignore_errors: true
  register: elasticsearch_no_index_present

# Populate with our own logs
- name: Populate elasticsearch index with local logs
  shell: cat /var/log/messages | /opt/logstash/bin/logstash -f /etc/logstash/conf.d/10-syslog.conf
  when: elasticsearch_no_index_present.stdout|int != 1

- name: Install kibana rpms
  yum: name={{ item }} state=present
  become: true
  with_items:
{'fraction_non_alphanumeric': 0.09990393852065321, 'fraction_numerical': 0.012487992315081652, 'mean_word_length': 3.4699570815450644, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '5268130', 'n_tokens_mistral': 753, 'n_tokens_neox': 728, 'n_words': 219}