Ansible role solr
Apache Solr for Linux.
GitHub | Version | Issues | Pull Requests | Downloads |
---|---|---|---|---|
This example is taken from molecule/default/converge.yml
and is tested on each push, pull request and release.
---
- name: Converge
hosts: all
become: true
gather_facts: true
pre_tasks:
- name: Set Java 8 package for RedHat.
ansible.builtin.set_fact:
java_packages:
- java-1.8.0-openjdk
when: ansible_os_family == "RedHat"
- name: Set Java 8 package for Ubuntu.
ansible.builtin.set_fact:
java_packages:
- openjdk-8-jdk
when: ansible_os_family == "Ubuntu"
- name: Set Java 11 package for Debian.
ansible.builtin.set_fact:
java_packages:
- openjdk-11-jdk
when: ansible_os_family == "Debian"
- name: Update apt cache.
ansible.builtin.apt: update_cache=true cache_valid_time=600
when: ansible_os_family == "Debian"
# See: http://unix.stackexchange.com/a/342469
- name: Install dependencies (Debian).
ansible.builtin.apt:
name:
- openjdk-11-jre-headless
- ca-certificates-java
state: present
when: ansible_distribution == "Debian"
roles:
- role: buluma.java
- role: buluma.solr
The machine needs to be prepared. In CI this is done using molecule/default/prepare.yml
:
---
- name: Prepare
hosts: all
gather_facts: false
become: true
roles:
- role: buluma.bootstrap
- role: buluma.java
Also see a full explanation and example on how to use these roles.
The default values for the variables are set in defaults/main.yml
:
---
solr_workspace: /root
solr_create_user: true
solr_user: solr
solr_group: "{{ solr_user }}"
solr_version: "8.11.2"
solr_mirror: "https://archive.apache.org/dist"
solr_remove_cruft: false
solr_service_manage: true
solr_service_name: solr
solr_service_state: started
solr_install_dir: /opt
solr_install_path: "/opt/{{ solr_service_name }}"
solr_home: "/var/{{ solr_service_name }}"
solr_connect_host: localhost
solr_port: "8983"
solr_xms: "256M"
solr_xmx: "512M"
solr_timezone: "UTC"
# solr_opts: "$SOLR_OPTS -Dlog4j2.formatMsgNoLookups=true"
solr_cores:
- collection1
solr_default_core_path: "{% if solr_version.split('.')[0] < '9' %}{{ solr_install_path }}/example/files/conf/{% else %}{{ solr_install_path }}/server/solr/configsets/_default/conf/{% endif %}"
solr_config_file: /etc/default/{{ solr_service_name }}.in.sh
# Enable restart solr handler
solr_restart_handler_enabled: true
# Used only for Solr < 5.
solr_log_file_path: /var/log/solr.log
solr_host: "0.0.0.0"
- pip packages listed in requirements.txt.
The following roles are used to prepare a system. You can prepare your system in another way.
Requirement | GitHub | Version |
---|---|---|
buluma.bootstrap | ||
buluma.java |
This role is a part of many compatible roles. Have a look at the documentation of these roles for further information.
Here is an overview of related roles:
This role has been tested on these container images:
container | tags |
---|---|
EL | 9, 8 |
Fedora | all |
The minimum version of Ansible required is 2.12, tests have been done to:
- The previous version.
- The current version.
- The development version.
If you find issues, please register them in GitHub