Category Archives: Enterprise Cloud

Nutanix post build configuration script

When building out a net new Nutanix cluster, foundation does the majority of the work for you imaging the nodes, creating a cluster and populating the majority of configurations, however I wrote this (very basic) script to assist a customer with their post build configuration to ensure all their builds were standardised. Simply populate the variables and execute from a CVM.

#!/bin/bash

#####################################################################
# Simple Bash Script for Post Cluster Foundation Build Automation
# Use # to ignore any commands that are not needed
# Script Configures both Nutanix cluster and VMware ESXi hostips
# SCP Script to /home/nutanix to a CVM
# Use chmod +y to allow execution#
# ./ to execute#
# All items in CAPS should be environment specific
#####################################################################

#Specify the variables to save editing the script
NCLI=/home/nutanix/prism/cli/ncli
DNS=x.x.x.x
NTP=x.x.x.x
PRISM_CENTRAL=x.x.x.x
PRISM_CENTRAL_USERNAME=xxxx
PRISM_CENTRAL_PASSWORD=xxxx
WEB_PROXY_ADDRESS=x.x.x.x
WEB_PROXY_PORT=x.x.x.x
NEW_PRISM_PASSWORD=xxxx
LDAP_IP=x.x.x.x
DOMAIN_NAME=xxxx
EMAIL=xxxx
SYSLOG_IP=x.x.x.x
SYSLOG_PORT=x.x.x.x
SMTP_SERVER_IP=x.x.x.x
VCENTER_NAME=x.x.x.x
VCENTER_IP=x.x.x.x
VCENTER_USERNAME=xxxx
VCENTER_PASSWORD=xxxx
VLAN_ID=x.x.x.x

#Parameters below here should not need changing if the variable has been set above
#If you want to ignore a command you can put a # at the start of the line

echo ******************* Nutanix Cluster Configuration *******************

#Specify DNS Server(s)
echo Set Name Servers
$NCLI cluster add-to-name-servers servers=$DNS

#Specify NTP Server(s)
echo Set NTP Servers
$NCLI cluster add-to-ntp-servers servers=$NTP

#Register with Prism Central
echo Register Prism Central Server
$NCLI multicluster add-to-multicluster external-ip-address-or-svm-ips=$PRISM_CENTRAL username=$PRISM_CENTRAL_USERNAME password=$PRISM_CENTRAL_PASSWORD

#Set Web Proxy
echo Set Web Proxy and whitelist Prism Central Server
$NCLI http-proxy add name=proxy_name address=$WEB_PROXY_ADDRESS port=$WEB_PROXY_PORT proxy-types=http,https

#Set Cluster Timezone
echo Setting Cluster Timezone
$NCLI cluster set-timezone timezone=Europe/London

#Change default Prism password
echo Setting Default Prism Password
$NCLI user change-password current-password=admin new-password=$NEW_PRISM_PASSWORD

#Create AD Connection
echo Connect to domain
$NCLI authconfig create-directory directory-type=ACTIVE_DIRECTORY connection-type=LDAP directory-url=ldap://$LDAP_IP:389 domain=$DOMAIN_NAME name=$DOMAIN_NAME

#Create AD role mapping for User Admin Role
echo Set Role Mapping for User Admin Role
$NCLI authconfig add-role-mapping role=ROLE_USER_ADMIN entity-type=GROUP entity-values=GROUP NAME name=NAME

#Create AD role mapping for Cluster Admin Role
echo Set Role Mapping for CLuster Admin Role
$NCLI authconfig add-role-mapping role=ROLE_CLUSTER_ADMIN entity-type=GROUP entity-values=GROUP NAME name=NAME

#Enable syslog with level warning for all components
echo Set Syslog with level warning for all components
$NCLI rsyslog-config set-status enable=false
$NCLI rsyslog-config add-server name=NAME ip-address=$SYSLOG_IP port=SYSLOG_PORT network-protocol=udp
$NCLI rsyslog-config add-module server-name=NAME module-name=cassandra level=ERROR
$NCLI rsyslog-config add-module server-name=NAME module-name=cerebro level=ERROR
$NCLI rsyslog-config add-module server-name=NAME module-name=curator level=ERROR
$NCLI rsyslog-config add-module server-name=NAME module-name=genesis level=ERROR
$NCLI rsyslog-config add-module server-name=NAME module-name=prism level=ERROR
$NCLI rsyslog-config add-module server-name=NAME module-name=stargate level=ERROR
$NCLI rsyslog-config add-module server-name=NAME module-name=zookeeper level=ERROR
$NCLI rsyslog-config set-status enable=true

#Set SMTP server details
echo Set SMTP server details
$NCLI cluster set-smtp-server address=$SMTP_SERVER_IP port=’25’ from-email-address=$EMAIL

#Enable Pulse
echo Enable Pulse
$NCLI pulse-config update enable-default-nutanix-email=true email-contacts=$EMAIL enable=true

#Register with vCenter for CRUD Operations
echo Regiser with vCenter Server
$NCLI managementserver add-name=$VCENTER_NAME url=$VCENTER_IP username=$VCENTER_USERNAME password=$VCENTER_PASSWORD type=”vmware”

#Configure Alerts Email Address
echo Configure Email Alerts
$NCLI alerts edit-alert-config enable=”true” enable-default-nutanix-email=”true” email-contacts=$EMAIL

#Configure vSwitch0 VLAN ID
for i in `hostips`; ssh -f [email protected]$i ‘nohup sleep 60 && esxcfg-vswitch -p ALL -v VLAN_ID vSwitch0’;done

Upgrading vSphere from Nutanix Prism

Nutanix customers love the fact we give them their weekends back by having 1-click upgrades for the Acropolis operating system, BIOS, BMC, Firmware and the Hypervisor. When speaking to some customers still go through a multi-step process to include:

Download Updates in VUM
Create a new baseline
Attach Hosts to baseline and scan hosts to validate
Place DRS to manual and evacuate guests from the host
Issue shutdown command to CVM
Place host into maintenance mode
Proceed with remediation wizard
Complete upgrade
Reboot host
Power on CVM
Validate RF in Prism and move on

Yes, a couple of these steps are added compared to non-Nutanix environments, however there are still a number of steps that need to be completed.

With Prism, as long as the cluster is managed with vCenter, we are able to manage the entire process for you, by simply opening the upgrade tab, uploading the offline upgrade package with the json file from the Nutanix support portal and off you go! It’s as simple as that, and here’s another video to show the process.

Expanding a Nutanix Cluster

Number two in the video series……

One of the major appeals of Nutanix is pay as you grow economics. Start small and grow large, no forklift upgrades and having to forecast what your growth will be over the next ‘N’ years. Once you have your initial three node cluster, you can expand out your cluster at any time simply and non disruptively via Prism, you can even mix model types too to run different workloads in the same cluster. 

As you will have seen from the last video (if you haven’t it can be found here), foundation is now CVM based, therefore you can image nodes at the same time you expand out a cluster. Foundation will look at the baseline of the cluster (AOS version ‘X’ and Hypervisor version ‘Y’) and allow you to image a factory configured node to the same settings as your cluster and immediately add the capacity (storage and compute) to that cluster. This is the same regardless of adding a node or a block….

Here’s a video (sped up again) to show the process: