Ansible for SAN Automation: Part 1 Introduction

automation ansible

It has been quite a while since I posted. Sorry for the year + long hiatus. I have a lot of work that I would like to document on my Blog. About 9 months ago I accepted a new role at a new job. That came with the usual flurry of new work, learning their environments and equipment. But one of the major areas I have found my current employer was lacking was in automation so its been one of my main priorities to fill the gaps in my teams processes so that we can work smarter not harder.

The perfect choice for SAN automation,

in my mind anyway, is Ansible because ansible is capable of everything you need in a single tool; Configuration Management, Orchestration, Deployment, and Provisioning. Put succinctly, ansible is made for infrastructure fleet management. Quite a few times I have had lively debates with other engineers who prefer to use some other method for automation, usually powershell. And I am not knocking powershell, but ansible is simply superior for fleet management. Call me when you have hundreds of NAS devices, dozens of switches, and 50 petabytes across dozens of block storage arrays, powershell scripts that need to be altered and ran against each device will prove to be a time suck. With ansible no client needs to be installed on the device you wish to manage. Perfect for all those high dollar enterprise storage arrays and blackbox appliances where you have no access to install software anyway. Ansible can really manage anything, most vendors or even the community have already created modules and collections to manage equipment that are"idempotent" but even if its some obscure or older equipment you can still probably manage it with ansible. In practice, anything you can SSH into and run commands can be managed with ansible but even if you have no command line or way to control the application from the command line Ansible can also interface and communicate with anything that has an API. Ansible has a built in curl module called uri.. but I am getting ahead of myself.

I hope this to be the first post in a long series where I document how to build a Storage Area Network using automation everywhere. My end goal being to give old school storage engineers a glimpse of how Infrastructure-as-Code can improve their workflow and to showcase what a truly immutable SAN infrastructure can look like. The prerequisite of course is to install and set up Ansible on a system, perhaps a server node somewhere or even just your personal laptop.

This series does not aim to serve as a tutorial

for you to learn ansible, there are far better free resources than this site and far better teachers than I so I wont even attempt but I will give you some direction for installing and setting up your first "Ansible Control Node". My instructions below are meant to be quick and dirty but the official documentation may be required on some platforms.

A Container:
My favorite way to get a control node incredibly quickly is using bluxmit's ansible-terraform-workspace container. I love this so hard just because you get an immutable container, fully setup with ansible and everything you need or could want to be immediately productive.

docker run --name ansible-workspace -d -p 8020-8035:8020-8035 -p 9000:9000 -e WRK_HOST="<ip-of-your-ansible-server>" alnoda/ansible-terraform-workspace

Linux:

for the simplest way to get the latest stable version

pip install ansible

some distros like RHEL/CentOS 8 might require you to use

pip3 install ansible

or perhaps you might need a package through your package manager (likely an older version)

yum install ansible

MacOS:

first you'll need homebrew installed, then,

brew install ansible

Windows:

not recommended.

Regardless of which platform or method you use, after installation I recommend you define an inventory file, alter any options as you please in the /etc/ansible/ansbile.cfg file, and install any galaxy modules you might need.

I have actually built a playbook to install all the galaxy modules I require for my infrastructure. Feel free to copy and customize it.

If you do need a basic tutorial on using Ansible

before getting started I recommend the following resources:

Books

Videos

In part 2 of this series I plan to tackle the hardest part of SAN automation, configuring your fiber channel switches. Stay tuned.

Previous Post Next Post