<commit_before>---
# Prereqs
- name: create logstash indexer group
  group: name=lsindex state=present
- name: create logstash indexer user
  user: name=lsindex state=present createhome=no shell=/bin/bash group=lsindex

# Online Install
- name: online install | download logstash
  get_url: url=https://download.elasticsearch.org/logstash/logstash/logstash-{{ logstash_indexer_version }}.tar.gz dest=/var/tmp/logstash-{{ logstash_indexer_version }}.tar.gz
  when: logstash_indexer_online_install
- name: online install | extract logstash installation
  unarchive: src=/var/tmp/logstash-{{ logstash_indexer_version }}.tar.gz copy=no dest={{ logstash_indexer_base_install_dir }}/ mode=0700 creates={{ logstash_indexer_base_install_dir }}/logstash-{{ logstash_indexer_version }}/bin/logstash
  notify:
    - restart logstash-indexer
  when: logstash_indexer_online_install

# Offline Install
- name: offline install | copy and extract logstash installation
  unarchive: src={{ logstash_indexer_installer_path }} dest={{ logstash_indexer_base_install_dir }}/ mode=0700 creates={{ logstash_indexer_base_install_dir }}/logstash-{{ logstash_indexer_version }}/bin/logstash
  notify:
    - restart logstash-indexer
  when: not logstash_indexer_online_install

# Configure
- name: install logstash indexer startup script
  template: src=logstash-indexer-sysvinit.j2 dest=/etc/init.d/logstash-indexer owner=root group=root mode=0755
  notify:
    - restart logstash-indexer
- name: install logstash indexer configuration
  template: src=logstash-indexer.conf.j2 dest={{ logstash_indexer_base_install_dir }}/logstash-{{ logstash_indexer_version }}/logstash-indexer.conf owner=lsindex group=lsindex mode=0755
  notify:
    - restart logstash-indexer
- name: grant directory permissions to logstash indexer user for installation directory
  file: path={{ logstash_indexer_base_install_dir }}/logstash-{{ logstash_indexer_version }} owner=lsindex group=lsindex recurse=true
- name: create logstash-indexer logs directory
  file: dest={{ logstash_indexer_base_logs_dir }}/logstash-indexer state=directory
- name: grant directory permissions to logstash indexer user for logs directory
  file: path={{ logstash_indexer_base_logs_dir }}/logstash-indexer owner=lsindex group=lsindex recurse=true
- name: create symlink to logstash indexer installation
  file: src={{ logstash_indexer_base_install_dir }}/logstash-{{ logstash_indexer_version }} path={{ logstash_indexer_base_install_dir }}/logstash-indexer state=link
# FIX: Patch for 1.4.0 issue when overriding JAVA_HOME (See https://logstash.jira.com/browse/LOGSTASH-1984)
- name: patching logstash 1.4.0 bug LOGSTASH-1984
  copy: src=logstash.lib.sh dest={{ logstash_indexer_base_install_dir }}/logstash-{{ logstash_indexer_version }}/bin/logstash.lib.sh owner=lsindex group=lsindex mode=0755
  when: logstash_indexer_version == "1.4.0" and logstash_indexer_java_home
# Run
- name: ensure logstash indexer is started and starts on boot
  service: name=logstash-indexer state=started enabled=yes<commit_msg>Force symlink overwrite to prevent failure when upgrading.<commit_after>---
# Prereqs
- name: create logstash indexer group
  group: name=lsindex state=present
- name: create logstash indexer user
  user: name=lsindex state=present createhome=no shell=/bin/bash group=lsindex

# Online Install
- name: online install | download logstash
  get_url: url=https://download.elasticsearch.org/logstash/logstash/logstash-{{ logstash_indexer_version }}.tar.gz dest=/var/tmp/logstash-{{ logstash_indexer_version }}.tar.gz
  when: logstash_indexer_online_install
- name: online install | extract logstash installation
  unarchive: src=/var/tmp/logstash-{{ logstash_indexer_version }}.tar.gz copy=no dest={{ logstash_indexer_base_install_dir }}/ mode=0700 creates={{ logstash_indexer_base_install_dir }}/logstash-{{ logstash_indexer_version }}/bin/logstash
  notify:
    - restart logstash-indexer
  when: logstash_indexer_online_install

# Offline Install
- name: offline install | copy and extract logstash installation
  unarchive: src={{ logstash_indexer_installer_path }} dest={{ logstash_indexer_base_install_dir }}/ mode=0700 creates={{ logstash_indexer_base_install_dir }}/logstash-{{ logstash_indexer_version }}/bin/logstash
  notify:
    - restart logstash-indexer
  when: not logstash_indexer_online_install

# Configure
- name: install logstash indexer startup script
  template: src=logstash-indexer-sysvinit.j2 dest=/etc/init.d/logstash-indexer owner=root group=root mode=0755
  notify:
    - restart logstash-indexer
- name: install logstash indexer configuration
  template: src=logstash-indexer.conf.j2 dest={{ logstash_indexer_base_install_dir }}/logstash-{{ logstash_indexer_version }}/logstash-indexer.conf owner=lsindex group=lsindex mode=0755
  notify:
    - restart logstash-indexer
- name: grant directory permissions to logstash indexer user for installation directory
  file: path={{ logstash_indexer_base_install_dir }}/logstash-{{ logstash_indexer_version }} owner=lsindex group=lsindex recurse=true
- name: create logstash-indexer logs directory
  file: dest={{ logstash_indexer_base_logs_dir }}/logstash-indexer state=directory
- name: grant directory permissions to logstash indexer user for logs directory
  file: path={{ logstash_indexer_base_logs_dir }}/logstash-indexer owner=lsindex group=lsindex recurse=true
- name: create symlink to logstash indexer installation
  file: src={{ logstash_indexer_base_install_dir }}/logstash-{{ logstash_indexer_version }} path={{ logstash_indexer_base_install_dir }}/logstash-indexer state=link force=yes
# FIX: Patch for 1.4.0 issue when overriding JAVA_HOME (See https://logstash.jira.com/browse/LOGSTASH-1984)
- name: patching logstash 1.4.0 bug LOGSTASH-1984
  copy: src=logstash.lib.sh dest={{ logstash_indexer_base_install_dir }}/logstash-{{ logstash_indexer_version }}/bin/logstash.lib.sh owner=lsindex group=lsindex mode=0755
  when: logstash_indexer_version == "1.4.0" and logstash_indexer_java_home
# Run
- name: ensure logstash indexer is started and starts on boot
  service: name=logstash-indexer state=started enabled=yes
{'fraction_non_alphanumeric': 0.09678996252240508, 'fraction_numerical': 0.012709793058497638, 'mean_word_length': 6.0389908256880735, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1045906', 'n_tokens_mistral': 2099, 'n_tokens_neox': 2064, 'n_words': 469}