Looking to take Nutanix for a free test drive?
Click on the following to see what it's all about:

Nutanix Calm DSL – Quick Tips

Nutanix Calm DSL - Quick Tips

By now many will be aware of how powerful the simplest things can be. Things like working with Nutanix Calm, which can be controlled via multiple mechanisms, are now simpler than ever.

Along the way, though, it’s easy to forget just how simple some of those things can be. Today’s quick article shines a light on three of those things, hopefully being the catalyst for an a-ha moment that hasn’t occurred until now.

Container “Quick Start”

Did you know the Nutanix Calm DSL is available as both a Docker container you can build yourself and as a published container on Docker Hub? If you have Docker installed and have access to Docker Hub, firing up a Nutanix Calm DSL container is as simple as this:

docker run -it ntnx/calm-dsl
Quickly launching the Nutanix Calm DSL container from Docker Hub

Project Switching

The Calm DSL carries out all operations by working with a Calm/Prism Central project. If an environment has multiple projects configured (a common situation) it may be a requirement to quickly switch from one project to another. Here’s the command to do that.

calm set config --project [project_name]
Example of configuring the Calm DSL and quickly switching to a different project

Specify Project within Blueprint

This is an option that hasn’t been discussed on Nutanix.dev, yet. Sure, projects can be quickly switched using “calm set config” as outlined above, but a blueprint’s project can also be defined within the blueprint itself. Take a quick look at the code snippet below.

from calm.dsl.builtins import Metadata

class BpMetadata(Metadata):
    project = Ref.Project("my_cool_project")

This is obviously not a complete blueprint, but demonstrates a couple of requirements.

  • The required modules are being imported as the first step
  • An instance of the Metadata class has been instantiated and named BpMetadata

When the BpMetadata instance is created, the Calm DSL will automatically detect the instance and use it as the “destination” project for the blueprint. Clever! One of the Calm DSL tests that uses this approach can be found here.

Bonus tips

Don’t forget the docs

The Calm DSL GitHub repo has a section entitled Examples, with a sample project flow for admin users. If you are new to the Calm DSL this example flow will demonstrate the use of Calm projects, user accounts, groups and access control policies with a view to scripting the beginnings of an entire environment. Make sure you check it out!

Delete all Blueprints – Use with caution!

While this tip isn’t specific to the Calm DSL, it shows how the Calm DSL can pipe its output to standard CLI commands. Use extreme caution with this one!

calm get bps -q | xargs -I{} calm delete bp {}

When used in a test environment, for example, commands like this clean up all blueprints so that a developer or automation engineer can “start from scratch”.

Now what?

Even though these quick tips are about as simple as things can get, there are many other Calm DSL resources available to you.

Thanks for reading and have a great day! 🙂

Nutanix CALM DSL LAB 1.0
AVAILABLE NOW!

logo_calm

Have you wanted to learn the Nutanix Calm DSL, but haven't been sure where to start?
Check out the Nutanix Calm DSL Lab 1.0 now!