Slide 1

Slide 1 text

Wrangling Elasticsearch with Ansible A love story….

Slide 2

Slide 2 text

kinda...

Slide 3

Slide 3 text

Who am I and why should you listen to me? ● Director of Engineering Operations ● Fedora Linux Contributor ● WireGuard VPN Packager ● Joined Kenna in 2015 as a Sr. Systems Engineer ● @jdoss on Twitter, Github, Copr and freenode.net ● Manage 5 production and 1 centralized logging clusters ● Over 4 billion documents with 200 million processed daily

Slide 4

Slide 4 text

It was a dark timeline in 2015 ● Running Elasticsearch 1.7.x on Ubuntu managed with Chef ● Elasticsearch was falling over every few days ○ 500 million documents (1 million processed daily) ○ 6TB of data ○ 20 data nodes ○ 80+ shards ● We used Elasticsearch in weird ways (11mb documents, all searchable data was stored on a single document) ● No method to upgrade Elasticsearch versions between devel and prod

Slide 5

Slide 5 text

It was not great but...

Slide 6

Slide 6 text

There was hope! ● Created by Michael DeHaan ● Initial released in 2012 ● Written in mostly Python ● Configuration management, infrastructure as code, Orchestration engine ● Agentless ● Acquired by Red Hat in 2015

Slide 7

Slide 7 text

Design Goals ● Secure ● Reproducible ● Maintainable ● Usable in development and production

Slide 8

Slide 8 text

Defining Elasticsearch Clusters in Code Kenna US Production

Slide 9

Slide 9 text

Defining Elasticsearch Clusters in Code Kenna GCP Production

Slide 10

Slide 10 text

Defining Elasticsearch Clusters in Code Kenna Development

Slide 11

Slide 11 text

Defining Elasticsearch Clusters in Code Kenna LAME (Logging, Alerting, Metrics, Events)

Slide 12

Slide 12 text

Ansible Inventory with Static Groups of Dynamic Groups

Slide 13

Slide 13 text

Ansible Inventory with Static Groups of Dynamic Groups

Slide 14

Slide 14 text

Ansible Group_Vars -- Kenna US Production

Slide 15

Slide 15 text

Ansible Group_Vars -- Kenna GCP Production

Slide 16

Slide 16 text

Ansible Group_Vars -- Kenna LAME

Slide 17

Slide 17 text

Ansible Group_Vars -- Kenna Development Role Defaults!

Slide 18

Slide 18 text

Ansible Roles! Roles are ways of automatically loading certain vars_files, tasks, and handlers based on a known file structure. Grouping content by roles also allows easy sharing of roles with other users.

Slide 19

Slide 19 text

Ansible Roles Quick Overview ● defaults - default variables for the role ● files - contains files which can be deployed via this role ● handlers - contains handlers, which may be used by this role or even anywhere outside this role. ● vars - other variables for the role ● tasks - contains the main list of tasks to be executed by the role ● templates - contains templates which can be deployed via this role ● meta - defines some meta data for this role

Slide 20

Slide 20 text

Kenna’s Ansible Elasticsearch Role -- Defaults

Slide 21

Slide 21 text

Kenna’s Ansible Elasticsearch Role -- Tasks

Slide 22

Slide 22 text

Kenna’s Ansible Elasticsearch Role -- Templates

Slide 23

Slide 23 text

Ansible Playbook

Slide 24

Slide 24 text

TL; DR

Slide 25

Slide 25 text

If you take six points home... ● Define your cluster in code! ● Use tags/labels to define instance types for your inventory! ● Static Groups of Dynamic Groups! ● Use group_vars on those static groups! ● Have sane default variables! ● Use Ansible to manage your Elasticsearch clusters!