Ryan Yacyshyn

Installing Solr via Ansible

By Ryan Yacyshyn | Published Nov 1st, 2014

Solr is an open-source enterprise search engine made by Apache, and automating the install process with Ansible a great way to speed up the process, reduce mistakes and missed steps. The other advantage of course is the ability to install on multiple servers at the same time knowing that all will be exactly the same.

Creating the Ansible role was done following DigitalOcean's How To Install Solr on Ubuntu 14.04 guide. The role installs Solr manually so that you can choose which version you want to use and also allows you to install on any Ubuntu version. The role roughly does this:

  1. Updates apt cache.
  2. Installs openjdk-7-jdk.
  3. Downloads the specified version of Solr and extracts file.
  4. Copies some Jetty configs and logging files over.
  5. Creates new user.
  6. Downloads Jetty start-up script.
  7. Sets Jetty to run as a service and restarts Jetty.

Download the role here and try it out.

Soon after I created this, I found a very detailed role on the Ansible Galaxy created by alexanderjardim --- great for when you need more control over how Solr is installed.