Installing Solr via Ansible
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:
- Updates apt cache.
- Installs openjdk-7-jdk.
- Downloads the specified version of Solr and extracts file.
- Copies some Jetty configs and logging files over.
- Creates new user.
- Downloads Jetty start-up script.
- 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.