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
|
2018-12-20 17:55:38 +01:00
|
|
|
template: src=solr dest=/etc/init.d/solr mode=0755 owner=root group=root
|
2016-05-19 16:13:56 +02:00
|
|
|
|
|
|
|
- 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
|
2018-07-10 19:14:27 +02:00
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: Create the Solr prometheus exporter conf directory
|
|
|
|
file: dest={{ solr_prometheus_conf_dir }} state=directory mode=0755
|
|
|
|
|
|
|
|
- name: Install the Solr prometheus exporter config file
|
|
|
|
template: src=solr-exporter-config.xml dest={{ solr_prometheus_conf_file }} mode=0644
|
|
|
|
notify: Restart Solr prometheus exporter
|
2018-07-12 19:18:35 +02:00
|
|
|
tags: [ 'solr', 'solr_prometheus', 'solr_prometheus_exporter', 'solr_prometheus_exporter_config' ]
|
2018-07-10 19:14:27 +02:00
|
|
|
|
|
|
|
- name: Install the Solr prometheus exporter upstart script
|
|
|
|
template: src=solr_prometheus_exporter.upstart.j2 dest=/etc/init/solr_prometheus_exporter.conf mode=0644 owner=root group=root
|
|
|
|
when: ansible_service_mgr != 'systemd'
|
|
|
|
|
|
|
|
- name: Install the Solr prometheus exporter systemd unit
|
|
|
|
template: src=solr_prometheus_exporter.systemd.j2 dest=/etc/systemd/system/solr_prometheus_exporter.service mode=0644 owner=root group=root
|
|
|
|
when: ansible_service_mgr == 'systemd'
|
|
|
|
notify: systemd reload
|
|
|
|
|
|
|
|
- name: Ensure that Solr prometheus exporter is started and enabled
|
|
|
|
service: name=solr_prometheus_exporter state=started enabled=yes
|
|
|
|
|
|
|
|
become: True
|
|
|
|
become_user: root
|
|
|
|
when:
|
|
|
|
- solr_install
|
|
|
|
- solr_prometheus_exporter
|
|
|
|
tags: [ 'solr', 'solr_prometheus', 'solr_prometheus_exporter' ]
|
|
|
|
|