51 lines
1.4 KiB
YAML
51 lines
1.4 KiB
YAML
---
|
|
- name: Ubuntu server with Solr
|
|
hosts: ubu
|
|
become: true
|
|
|
|
vars_files:
|
|
- solr-vars.yaml
|
|
|
|
pre_tasks:
|
|
- name: Update apt cache if needed.
|
|
ansible.builtin.apt:
|
|
update_cache: true
|
|
cache_valid_time: 3600
|
|
|
|
tasks:
|
|
- name: Install Java.
|
|
ansible.builtin.apt:
|
|
name: openjdk-11-jdk
|
|
state: present
|
|
|
|
- name: Get Solr.
|
|
ansible.builtin.get_url:
|
|
url: "https://archive.apache.org/dist/lucene/solr/{{ solr_version }}/solr-{{ solr_version }}.tgz"
|
|
dest: "{{ download_dir }}/solr-{{ solr_version }}.tgz"
|
|
checksum: "{{ solr_checksum }}"
|
|
mode: "644"
|
|
|
|
- name: Expand Solr archive.
|
|
ansible.builtin.unarchive:
|
|
src: "{{ download_dir }}/solr-{{ solr_version }}.tgz"
|
|
dest: "{{ download_dir }}"
|
|
remote_src: true
|
|
creates: "{{ download_dir }}/solr-{{ solr_version }}/README.txt"
|
|
|
|
- name: Run Solr installation script.
|
|
ansible.builtin.command:
|
|
argv:
|
|
- "{{ download_dir }}/solr-{{ solr_version }}/bin/install_solr_service.sh"
|
|
- "{{ download_dir }}/solr-{{ solr_version }}.tgz"
|
|
- -i /opt
|
|
- -d /var/solr
|
|
- -u solr
|
|
- -s solr
|
|
- -p 8983
|
|
creates: "{{ solr_dir }}/bin/solr"
|
|
|
|
- name: Ensure Solr is started and enabled on boot.
|
|
ansible.builtin.service:
|
|
name: solr
|
|
state: started
|
|
enabled: true
|