<commit_before>---
- name: Install lsof
  become: yes
  yum: name=lsof state=present

- name: Install unzip
  become: yes
  yum: name=unzip state=present

- name: Create solr group
  become: yes
  group: name=solr state=present

- name: Create solr user
  become: yes
  user: name=solr comment="Solr user" group=solr groups=solr shell="/sbin/nologin"

- name: Set solr_filename
  set_fact: >-
    solr_filename=solr-{{ solr_version }}

- name: Download SolR
  become: yes
  unarchive: src=http://archive.apache.org/dist/lucene/solr/{{ solr_version }}/{{ solr_filename }}.tgz dest="/opt/" copy=no
  
- name: Set permission
  become: yes
  file: path="/opt/{{ solr_filename }}" owner=solr group=solr mode=0755 recurse=yes

- name: Generate services definition
  become: yes
  template: src=solr.service.j2 dest=/etc/systemd/system/solr.service mode=0644

- name: Start Solr service
  become: yes
  service: name=solr state=started

- name: Create solr core path
  become: yes
  become_user: solr
  command: mkdir -p /opt/{{ solr_filename  }}/server/solr/potato/conf/
  args:
    creates: /opt/{{ solr_filename }}/server/solr/potato/conf/elevate.xml

- name: Move default config
  become: yes
  become_user: solr<commit_msg>Skip `solr` if version is already installed<commit_after>---
- name: Install lsof
  become: yes
  yum: name=lsof state=present

- name: Install unzip
  become: yes
  yum: name=unzip state=present

- name: Create solr group
  become: yes
  group: name=solr state=present

- name: Create solr user
  become: yes
  user: name=solr comment="Solr user" group=solr groups=solr shell="/sbin/nologin"

- name: Set solr_filename
  set_fact: >-
    solr_filename=solr-{{ solr_version }}

- name: Download SolR
  become: yes
  unarchive: src=http://archive.apache.org/dist/lucene/solr/{{ solr_version }}/{{ solr_filename }}.tgz dest="/opt/" copy=no creates="/opt/{{ solr_filename }}"  
  
- name: Set permission
  become: yes
  file: path="/opt/{{ solr_filename }}" owner=solr group=solr mode=0755 recurse=yes

- name: Generate services definition
  become: yes
  template: src=solr.service.j2 dest=/etc/systemd/system/solr.service mode=0644

- name: Start Solr service
  become: yes
  service: name=solr state=started

- name: Create solr core path
  become: yes
  become_user: solr
  command: mkdir -p /opt/{{ solr_filename  }}/server/solr/potato/conf/
  args:
    creates: /opt/{{ solr_filename }}/server/solr/potato/conf/elevate.xml

- name: Move default config
  become: yes
  become_user: solr
{'fraction_non_alphanumeric': 0.12554802710243124, 'fraction_numerical': 0.007174172977281785, 'mean_word_length': 3.8455598455598454, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6937605', 'n_tokens_mistral': 920, 'n_tokens_neox': 923, 'n_words': 239}