2016年4月25日 星期一

How to use Nutanix Prism deploy Business Critical Application


How to use Nutanix Prism deploy Business Critical Application


          Recently , Nutanix had announced a new NOS release 4.6 . One of the function is customized script to deploy your virtual machine .
In the Windows guest environment is very easy to prepared . We can use sysprep to deploy Windows guest OS . In Linux guest OS , we using cloud-init package to deploy.
         You can reference Chris Rasmussen site .
http://digitalformula.net/articles/nutanix-vm-customisation-with-cloud-init/
          Most of the steps are same, but some of configuration must be noted.
I use Oracle database and Oracle linux as a example . Oracle version is 11.2.0.4 , Oracle Linux is version 6.7.  Nutanix Acropolis Prism is 4.6.0.2 and we use Acropolis Hypervisor (AHV).


Step 1: Prepare your template image -


      First , we need to create a OS template that for deployment in your environment .  You can install a clean Linux OS environment or just clone from virtual machine. due to Linux OS always assign a new virtual NIC to new virtual machine. So you need to delete the /etc/udev/rules.d/70-persistent-net.rules .  Otherwise , you will have eth1,eth2 ,eth3 ... everytime you clone you get increase number . If you removed this file, after you clone virtual machine  . Linux OS will not increase the ethx number , will keep using eth0 .
     Secondary , you need to install the cloud-init package. Every Linux installation methods maybe not same . Some will use apt , some will use yum . Here is a example that install cloud-init package in Oracle Linux or RedHat, Centos .

  example :

wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh epel-release-6-8.noarch.rpm

yum install cloud-init




After installation , just leave everything default . Do not need to configure any setting .Because Nutanix Prism will help everything we need . Simplified cloud-init package setting .
The you need to put your Oracle installation binary in the OS , and also prepare auto-install script .  I create a simple one, and you can reference this. ( Not only Oracle have automatic installation , but also all Business Critical Application have it's owned automatic/silence installation method , you can script them easily)


From my example  - The script I created is called install_demo.sh. After steps , you can shutdown the virtual machine , and start put it into image service .

Step 2 : Create Image for deployment 


Nutanix Acropolis 4.6 provide upload image , you can upload image from the Prism GUI. 


            But if your virtual machine is on the AHV, you don't need to export and import again . Just using single commend to put your image into image service . We will use acli commend to put image into repository. command like this :
image.create autodeploy_oracle clone_from_vmdisk=vm:Goldmaster:scsi.0
** autodeploy_oracle is template name 
** Goldmaster:scsi.0 mean Goldmaster VM it's first scsi disk .







This command is take 1 second to finish . Go back to Prism check the image is successful installed.

Step 3: Deployment your Business Critical Application ( Oracle for ex , others same method)

     First you need to create a new VM- In the Prism , select the VM tab, and start to create a VM.


Give the CPU and Memory values - 


Add disk - Choose Operation , select "CLONE FROM IMAGE SERVICE" ,and select the image "autodeploy_oracle" the template we created.


Add the new NIC -


The key is "Custom Script" , Here are three options we can choose.  "ADFS" or "upload a file" or "Type or paste script". This time we use "Type or paste script". Because we need to change hostname and run the customized scripts. 


Type those text in the text box .

#cloud-config
disable_root: 0
ssh_pwauth:   1
hostname: Oracle112
runcmd:
- [/root/install_demo.sh,once-per-instance] 




Click Save , and wait for 100% create process . Must wait for 100 % ,otherwise you will get a failed ....








Step 4: Power on your VM - 


Just select power-on your Virtual Machine, also open your console . you will see the cloud-init is running. That means will change my hostname , and also automatic install Oracle binary and create database for me . 


I also put all process avi in this blog , you can reference . 




Conclusion :

   
    From my 19 years IT experience , when I talked to customers, they don't want a complicated solutions . They just want some simple and handle their daily job. 
   Some software they create too many object like blueprint , endpoint .. Really complicated solution. Some vender also mentioned they can deploy 10000 VMs in 10 minutes.  I think , in real world , we don't need this kind of software , because we didn't need deploy 10000 VMs everyday or need very complicated processes to deploy a VM .  Nutanix Prism already can help on your daily job to deploy those application for you. Make your life easier.