2016-05-19 16:13:56 +02:00
|
|
|
---
|
|
|
|
- block:
|
|
|
|
- name: Create a solr user
|
|
|
|
user: name={{ solr_user }} home={{ solr_base_dir }} createhome=yes shell=/bin/bash
|
|
|
|
|
2018-03-07 16:21:44 +01:00
|
|
|
- name: Create the downloads directory
|
|
|
|
file: dest={{ solr_download_dir }} state=directory
|
|
|
|
|
2016-05-19 16:13:56 +02:00
|
|
|
- name: Download solr
|
|
|
|
get_url: url='{{ solr_download_url }}' dest={{ solr_download_dir }}/solr-{{ solr_version }}.tgz validate_certs=no
|
|
|
|
|
|
|
|
- name: Unarchive solr release
|
2016-05-19 18:54:48 +02:00
|
|
|
unarchive: src={{ solr_download_dir }}/solr-{{ solr_version }}.tgz dest={{ solr_base_dir }} copy=no
|
2017-09-06 20:13:40 +02:00
|
|
|
args:
|
|
|
|
creates: '{{ solr_base_dir }}/bin/solr'
|
2016-05-19 16:13:56 +02:00
|
|
|
|
2016-05-19 18:54:48 +02:00
|
|
|
- name: Link to the latest release
|
2017-09-06 20:13:40 +02:00
|
|
|
file: src={{ solr_base_dir }}/solr-{{ solr_version }} dest={{ solr_server_dir }} state=link
|
2016-05-19 18:54:48 +02:00
|
|
|
|
2017-09-06 20:13:40 +02:00
|
|
|
- name: Create the solr service, download, data and logs directories
|
|
|
|
file: path={{ item }} state=directory owner={{ solr_user }} group={{ solr_user }}
|
|
|
|
with_items:
|
|
|
|
- '{{ solr_download_dir }}'
|
|
|
|
- '{{ solr_data_dir }}'
|
|
|
|
- '{{ solr_pid_dir }}'
|
|
|
|
- '{{ solr_log_dir }}'
|
|
|
|
|
|
|
|
- name: Fix the permissions of the solr server directory
|
|
|
|
file: dest={{ solr_data_dir }} state=directory owner={{ solr_user }} group={{ solr_user }} recurse=yes
|
|
|
|
|
|
|
|
- name: Create the solr lib directory
|
|
|
|
file: dest={{ solr_data_dir }}/lib state=directory
|
|
|
|
|
2018-01-27 15:56:24 +01:00
|
|
|
- name: Create the solr conf directory
|
|
|
|
file: dest={{ solr_conf_dir }} state=directory
|
|
|
|
|
2017-09-06 20:13:40 +02:00
|
|
|
- name: Install the zookeeper configuration
|
|
|
|
template: src={{ item }}.j2 dest={{ solr_data_dir }}/{{ item }}
|
|
|
|
with_items:
|
|
|
|
- solr.xml
|
|
|
|
- zoo.cfg
|
|
|
|
notify: solr restart
|
2017-12-12 17:13:07 +01:00
|
|
|
tags: [ 'solr', 'solr_default', 'solr_conf' ]
|
2016-05-19 16:13:56 +02:00
|
|
|
|
|
|
|
- name: copy extra libraries
|
2017-09-06 20:13:40 +02:00
|
|
|
shell: cd {{ solr_server_dir }}; cp -u {{ item }} {{ solr_data_dir }}/lib
|
2016-05-19 16:13:56 +02:00
|
|
|
with_items: '{{ solr_jar_files }}'
|
|
|
|
|
|
|
|
- name: install the solr init script
|
|
|
|
copy: src=solr dest=/etc/init.d/solr mode=0755 owner=root group=root
|
|
|
|
|
|
|
|
- name: Install the solr default
|
2017-09-06 20:13:40 +02:00
|
|
|
template: src=solr-default.j2 dest=/etc/default/solr.in.sh mode=0644 owner=root group=root
|
|
|
|
notify: solr restart
|
2017-12-12 17:13:07 +01:00
|
|
|
tags: [ 'solr', 'solr_default', 'solr_conf' ]
|
2016-05-19 16:13:56 +02:00
|
|
|
|
|
|
|
- name: Start and enable the solr service
|
|
|
|
service: name=solr state=started enabled=yes
|
2017-09-06 20:13:40 +02:00
|
|
|
ignore_errors: True
|
2016-05-19 16:13:56 +02:00
|
|
|
|
|
|
|
become: True
|
2017-09-06 20:13:40 +02:00
|
|
|
become_user: root
|
2016-05-19 16:13:56 +02:00
|
|
|
when: solr_install
|
|
|
|
tags: solr
|