Ansible For Aerospike
Tags: aerospike, ansible, devops, nosql
Published: 2020-07-01 07:59:31

Working as a Solution Architect for Aerospike I often have occasion to create Aerospike clusters on the fly. These might be for benchmarking, demonstration purposes or investigation of a query from a prospect or customer.

Although Aerospike is straightforward to [configure and install](https://www.aerospike.com/docs/operations/index.html), the relatively small number of steps you have to go through does begin to add up in aggregate. This becomes more significant when you might add in the need to configure TLS, encryption on disk, strong consistency, java benchmarking client or rack awareness to name a few of the options available.

One possibility is to make use of [Aerospike Kubernetes](https://github.com/aerospike/aerospike-kubernetes/tree/master/helm) but if what you’re doing demands high levels of performance, casual use will steer you towards using VMs.

To that end I’ve put together [aerospike-ansible](https://github.com/aerospike-examples/aerospike-ansible) a collection of Ansible scripts allowing configurable automation of the build of Aerospike clusters. The focus is on doing this on AWS as that’s the platform that Ansible best supports, but with a little [inventory](https://docs.ansible.com/ansible/2.3/intro_inventory.html) nous you can leverage these scripts on bare metal or alternate cloud provider environments*.

The scripts go beyond simply building clusters. The configurable deployment of Aerospike [Java benchmarking](https://github.com/aerospike/aerospike-client-java/tree/master/benchmarks) clients and the Prometheus/Grafana based [Aerospike Monitoring](https://github.com/aerospike/aerospike-monitoring) is also handled by the repository.

The [README](https://github.com/aerospike-examples/aerospike-ansible) goes into full detail, but key supported options are

- Instance type
- Hosts per AZ
- Community/Enterprise
- Encryption at rest (*)
- TLS
- Strong Consistency — including roster setup with rack awareness (*)
- Prometheus/Grafana monitoring stack
- Aerospike Version

(*) Aerospike Enterprise Only

There’s also a [video](https://youtu.be/fWKACehyJHc) showing end to end setup of the full Aerospike cluster/client/monitoring stack on a fresh Vagrant instance. It’s around 25 minutes long but it also goes through possible wrinkles relating to installation of Ansible plus [IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/introduction.html) setup. Colleagues tell me these scripts take as little as 5 minutes to use for the first time, even with zero knowledge of Ansible.

{% youtube fWKACehyJHc %}

I’m envisaging this being helpful to those looking to get Aerospike up and running for the first time. It allows easy setup for proof of concept and development work, while providing a production grade facility. You can tear it down just as easily as you stood it up, keeping costs low.

Providing additional recipes for operational procedures such as rolling upgrades or cluster migration is very much on the cards, so I hope to get further assets and blog posts out in this area.

Any questions/comments — please feed back through the GitHub [issues](https://github.com/aerospike-examples/aerospike-ansible/issues) facility.

[*] See the README for Google Cloud Platform details