Slides by Steven Swor
We want to upgrade Splunk
We don't have a test environment
Let's Build a Test Environment!
... in AWS
... with Terraform
... and Ansible
... A Brief Introduction
Steven Swor
sworisbreathing (GitHub, StackExchange)
steven_swor (Splunk Answers)
(TEL-struh)
To create a brilliant connected future for everyone
Telecommunications
Media
Lots of Other Stuff
Software Engineering
Functional and Performance Testing
Application Peformance Management
Write Jittery Presentations
Manage Infrastructure
(...except when I have to)
(a.k.a. "what are we upgrading?")
(spluhnk)
Big Data
Monitoring/Alerting
Analytics
Collect data (logs) from remote systems
Send collected data to indexers
Store collected data in indexes
Fetch data from indexes (e.g. run search jobs)
User Interface (Web)
Create/Dispatch Search Jobs
Really just configuration bundles
Can also include UI components (dashboards)
Deploys apps/addons to Splunk instances
(similar to Puppet/Chef, but Splunk-specific)
Upgrade Splunk across all environments
Improve Splunk app deployment process
Latest release: 6.2.3
Currently deployed: 5.0.2
5.x release is more than 24 months old
Will reach End-Of-Life when 7.x is released
VMs provisioned "in the cloud"
Pay only for what you use
Well-documented APIs for automation
Automates the nuts and bolts
Create VMs
Manage DNS and Networking
resource "aws_instance" "my_server_name" { instance_type = "t1.micro" ami = "${lookup(var.aws_amis, var.aws_region)}" key_name = "${var.TF_VAR_key_name}" connection { user = "ubuntu" key_file = "${var.TF_VAR_key_path}" } security_groups = [ "SSH" ] tags = { Name = "my_server_name" } }
Automates the OS bits
Install software
Start/stop services
Orchestrate across multiple hosts
--- - hosts: splunk_forwarders roles: - splunk_forwarder - hosts: splunk_servers roles: - splunk_server - splunk_deployment_server
Tells Ansible what hosts have what role
Static => Flat File, read when Ansible runs
Dynamic => Script, executed when Ansible runs
[splunk_forwarders] tldhybqat01vth ansible_ssh_user=ubuntu ansible_ssh_host=54.253.22.104 ... [splunk_forwarders:vars] splunk_forwarder_deployment_server_host=10.248.16.108 splunk_forwarder_indexer_host=10.248.16.108 [splunk_servers] tlpinfmgt03vth ansible_ssh_user=ubuntu ansible_ssh_host=54.206.204.196
Creates environment, gets IP addresses
Generates "static" Ansible inventory
(using a Terraform template)
Destroys environment when we are done
Reads "static" inventory
Creates local service accounts
Installs/updates software
Ensures daemon services are running
Everything in version control (git)
Feature branches for upgrade paths
To test an upgrade:
$ git checkout <branch_name> $ ansible-playbook ...
Time to create a new test environment from scratch: Less than 5 minutes
Environments created and destroyed in a two-week period: approx. 100
Shell scripts for data collection (Unix TA) lost their execute permissions
(refactoring was performed on Windows)
Fixed before it went into Production
(yaaay testing!)
Would not overwrite existing files/folders
Manual intervention required for these hosts
Upgrade of Splunk was only tested on Ubuntu
(I forgot they were using multiple distros)
Version Control Repo not up-to-date
Restored from nightly backup
(and version control updated)
(yaaay backups!)
Cloud is well suited for this use case
Tooling is easy to learn
(I can barely spell AWS)
There's no excuse for having to wait for a test environment anymore
Makes writing presentations easy
Makes transforming HTML easy
Used with permission from Asymmetric Publications