In our most recent article, titled Nutanix Calm DSL – Creating Custom Blueprint, we talked about a whole bunch of different things. If you haven’t read that article (it is a recommended read), here are the highlights of what was covered.
- Creating a custom blueprint by manually writing the required Python code
- Demonstrated how to create secure blueprint credentials
- Split our blueprint into a modular structure for the required installation scripts
- Broke our VM specs into modular, easily-manageable YAML files
It’s the last step above that we’re going to look at today. Unlike the last article, this one’s going to be much shorter and will show how we can almost completely avoid the need to manually write a single line of YAML.
Before continuing, please note you will need a connection between your workstation/laptop and your configured Prism Central instance. You’ll see why in a moment.
Spec Example
Shown below is an example of a YAML spec used in the last article. We don’t go into details about what each line does (the last article did that) and will just have this here for reference. This particular spec is for the HA Proxy server from our LAMP application.
categories: {}
name: HAPROXY
resources:
boot_config:
boot_device:
disk_address:
adapter_type: SCSI
device_index: 0
disk_list:
- data_source_reference:
kind: app_package
name: CENTOS_7_CLOUD
device_properties:
device_type: DISK
disk_address:
adapter_type: SCSI
device_index: 0
disk_size_mib: 0
guest_customization:
cloud_init:
user_data: |
#cloud-config
users:
- name: centos
ssh-authorized-keys:
- '@@{CENTOS.public_key}@@'
sudo:
- ALL=(ALL) NOPASSWD:ALL
memory_size_mib: 4096
nic_list:
- ip_endpoint_list: []
network_function_nic_type: INGRESS
nic_type: NORMAL_NIC
subnet_reference:
kind: subnet
uuid: f5606fed-2c33-45e8-9ccf-303db6eb93d8
num_sockets: 2
num_vcpus_per_socket: 2
One Command to Rule Them All
What if we don’t want to “mess around” and manually create our provider specs? As you’ll see in both this article and other upcoming articles, the Nutanix Calm engineering team has taken considerable time to make sure the most useful functions are available in the Calm DSL.
Take a look at the command below:
calm create provider_spec
Pretty simple, right? By default, that command will walk through the generation of a valid Calm DSL provider spec in YAML format, without needing to know any YAML yourself. Let’s take a look:
Looking at the screenshot above, we can see the sorts of information the DSL will prompt for when generating the YAML provider spec. It’s also where we can circle back to a comment I made earlier; when running the command, you must have a connection to your configured Prism Central instance. Why? If you look closely, you’ll see the DSL has presented us with numbered choices at each step, choices that are generated on the fly by requesting entity lists from Prism Central. Without a connection to Prism Central, the entity lists would fail.
For the sake of simplicity, I’ve broken the full output of the command into two parts. The second part is shown below – the complete YAML spec based on our inputs.
From here it’s simply a case of taking the generated YAML above and adding it to a YAML spec file ready for use in the blueprint. This process is outlined in the previous article, Nutanix Calm – Creating Custom Blueprint.
One Important Note
At this point it’s important to note the YAML spec above is specifically for AHV. This is the same as if we’d run the command below. In other words, if you don’t specify a provider type, AHV is assumed.
calm create provider_spec --type AHV_VM
If we pass the -h or –help switch to the command, we can easily see the supported provider types:
Purely as an example, and with the output truncated, let’s look at what happens if we tell the DSL to create an AWS VM provider spec:
Wrapping Up
Based on this reasonably quick article, you can see how the Calm engineering team has built features that mean writing code isn’t always needed. In fact, one of our engineering VPs recently said “Humans should use the DSL”. I think that sums up the DSL’s intentions perfectly.
For more information on the Calm DSL, please see the Calm DSL GitHub repository, although more information will be added to Nutanix.dev in the coming days and weeks.
Thanks for reading and have a great day! 🙂