Introduction
As workloads grow, Nutanix clusters must scale to meet demand. While Prism simplifies node addition, using ncli and Bash provides automation for site builds, disaster recovery scenarios, and DevOps pipelines. This guide outlines how to script and repeatably expand your Nutanix cluster using CLI tools.
My Personal Repository on GitHub
Diagram: Cluster Expansion Automation Flow

Requirements
- New node must have Nutanix Foundation or Hypervisor installed
- IP connectivity to CVM IP addresses
- Host UUID or IP (depending on method)
YAML Example: nodes.yaml
nodes:
- ip: 10.10.10.101
hostname: ntx-node04
rackable_unit_serial: NX123456789
- ip: 10.10.10.102
hostname: ntx-node05
rackable_unit_serial: NX123456790
Bash Script: nutanix_cluster_expand.sh
#!/usr/bin/env bash
set -euo pipefail
spec="nodes.yaml"
log="/var/log/nutanix_cluster_expand.log"
for i in $(yq e '.nodes | keys | .[]' "$spec"); do
ip=$(yq e ".nodes[$i].ip" "$spec")
host=$(yq e ".nodes[$i].hostname" "$spec")
serial=$(yq e ".nodes[$i].rackable_unit_serial" "$spec")
echo "[$(date)] Adding node $host ($ip) Serial: $serial" | tee -a "$log"
ncli host add-node external-ip-address="$ip" rackable-unit-serial-number="$serial" hostname="$host"
done
Monitor Progress
Use this command to view cluster state post-expansion:
ncli host list
Optional: Validate Foundation Completion
Ensure that host imaging and cluster pre-checks are done before running this script.
Summary
Automating Nutanix cluster growth allows you to expand rapidly and consistently. Whether building out a new rack, standing up a DR region, or scaling edge deployments, ncli and Bash provide robust tools to script every step.
External Documentation:
Introduction Once your Ansible control node is configured, deploying a virtual machine on Nutanix AHV is just a few lines of YAML...