ansible-roles/solr/tasks/main.yml

44 lines
1.4 KiB
YAML

---
- block:
- name: Create a solr user
become: False
user: name={{ solr_user }} home={{ solr_base_dir }} createhome=yes shell=/bin/bash
- name: Create the solr service and download directories
file: path={{ item }} state=directory
with_items: [ '{{ solr_download_dir }}' ]
- name: Download solr
get_url: url='{{ solr_download_url }}' dest={{ solr_download_dir }}/solr-{{ solr_version }}.tgz validate_certs=no
- name: Unarchive solr release
unarchive: src={{ solr_download_dir }}/solr-{{ solr_version }}.tgz dest={{ solr_base_dir }} copy=no
- name: Link to the latest release
file: src=solr-{{ solr_version }} dest={{ solr_data_dir }} state=link
- name: create solr lib dir
file: path={{ solr_data_dir }}/server/solr/lib state=directory
- name: copy extra libraries
shell: cd {{ solr_data_dir }}; cp -u {{ item }} {{ solr_data_dir }}/server/solr/lib
with_items: '{{ solr_jar_files }}'
- name: install the solr init script
become: False
copy: src=solr dest=/etc/init.d/solr mode=0755 owner=root group=root
- name: Install the solr default
become: False
template: src=solr-default.j2 dest=/etc/default/solr mode=0644 owner=root group=root
- name: Start and enable the solr service
become: False
service: name=solr state=started enabled=yes
become: True
become_user: '{{ solr_user }}'
when: solr_install
tags: solr