Automating VxRail with Ansible

To coincide with our latest release of VxRail, we have also released Ansible modules on Ansible Galaxy. This allows system administrators to now leverage Ansible to automate many tasks, such as deployment, expansion and checking system health.

For this blog post, I’ll run through how to get the modules installed and show two playbook examples.

So, where do we get these modules?

Installing the modules is an easy process for anyone familiar with Ansible. Just head on over to the Galaxy website, here.

Like most other collections, there’s a couple ways to get the modules. The easiest is to simply use the command ‘ansible-galaxy collection install dellemc.vxrail’.

If you prefer, you can always download the tarball and install manually.

That’s it! Now that we have the modules installed we can move on to taking a look at a couple of the sample playbooks included in the collection.

Build me a VxRail cluster!

So let’s start with how we can leverage Ansible to actually build our cluster.

Before we begin, we’re going to need to do two things:

  1. Make sure that our VxRail Manager VM is accessible on the network. The Ansible server will need to be able to connect to it.

    The easiest option here is to re-ip your VxRail Manager (VXRM) VM so that it has a real IP address on your network. We can do this a few ways, but the easiest is to either use the Network Imaging Tool (NIM) or by using the Powershell module (covered here).

  2. A valid JSON config file which contains all of our parameters for the build. To generate the JSON file, we can head over to the Config Portal. Step through the process and enter all of the required information and at the end you’ll be able to download the JSON file.

    Now that we have those things out of the way, let’s take a look at the ‘day1_initialization’ playbook.

Day1 Initialization

The playbook itself is pretty basic. In the sample that comes with the collection, the variables are defined in the playbook itself, under the ‘vars’ section. To make things easier for myself, I simply created a new file called “r1c3_vars.yml” that contains all of the variables I need and referenced that in the ‘vars_files’ section. This saves having to type the same variables in multiple playbooks and makes changing a variable easier.

Here’s what that looks like:

To run the playbook, it’s a simple matter of using the ‘ansible-playbook day1_initialization.yml’ command.

Roughly 50 minutes later we are done!

Now rebuilding your VxRail cluster won’t be an every-day type of task, but for customers who have 100’s or 100’s of nodes it makes building the new clusters a much more stream lined process.

Next, let’s look at how we can expand our cluster by adding a new node.

Add a Node

The playbook for adding a new node is shown below and you’ll notice there’s quite a few more variables we need here. These are all things that would need to be done through the UI wizard, so nothing new here.

Again, I’m referencing a variables file “r1c3_node04_vars” here to make life easier.

So let’s run our playbook with ‘ansible-playbook addnode.yml’ and wait for the magic to happen.

And voila! Our new node is now a part of the cluster, in maintenance mode, waiting for either some extra configuration or ready to be put into production.

Hopefully these two examples have shown just how easy it is for IT Administrators to leverage Ansible to build, expand and monitor their VxRail systems.

Share the Post:

Related Posts

%d bloggers like this: