VMware Cloud Community
baltar
Contributor
Contributor
Jump to solution

Script adding list of NFS exports to all VMWare servers in VI?

Anybody have an existing easy solution? Is there a way to add an NFS export to a list of hosts instead of manually adding that storage to each and every host, or am I doomed to doing it individually? Thanks in advance for your input!

Reply
0 Kudos
1 Solution

Accepted Solutions
lamw
Community Manager
Community Manager
Jump to solution

Doom? You're never doom, anything you can do repetitively means there's always a way to automate, may not be pretty but there's usually a way Smiley Wink

Anywho, enough of that. You have a few solutions depending on where you want to automate or kickoff this process. If you're talking about Windows you can use VI Perl Toolkit/RCLI for Windows or even Powershell (for Powershell there is a forum and I'm sure you can get your answer there)

If you're looking to kick this off from say a each ESX 3.5 host, you can use esxcfg-nas or vmware-vim-cmd to automate this process:

esxcfg-nas: you can just run the command and you'll get a list of options. You can wrap this in a quick shell script and SSH to each host to mount your NFS datastores.

vmware-vim-cmd:

vmware-vim-cmd hostsvc/datastore/nas_create [DISPLAY_NAME] [NFS_SERVER_IP] [MOUNT_PATH] [MODE(readwrite=1/readonly=0)]

(e.g.)
vmware-vim-cmd hostsvc/datastore/nas_create MY_NFS_DATASTORE 172.30.0.254 /nfs/mount/point 1

If you're looking to remotely do this, you can look at a management appliance by VMware called VIMA

You can use VI Perl Toolkit or the RCLI which provides remote utilities similar to that of the standard commands found on the ESX Service Console in the form of (vicfg-,esxcfg-)

You have much to choose from and depending where you want to kick it off and what environment you feel comfortable these are your options.

Good Luck

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

View solution in original post

Reply
0 Kudos
3 Replies
lamw
Community Manager
Community Manager
Jump to solution

Doom? You're never doom, anything you can do repetitively means there's always a way to automate, may not be pretty but there's usually a way Smiley Wink

Anywho, enough of that. You have a few solutions depending on where you want to automate or kickoff this process. If you're talking about Windows you can use VI Perl Toolkit/RCLI for Windows or even Powershell (for Powershell there is a forum and I'm sure you can get your answer there)

If you're looking to kick this off from say a each ESX 3.5 host, you can use esxcfg-nas or vmware-vim-cmd to automate this process:

esxcfg-nas: you can just run the command and you'll get a list of options. You can wrap this in a quick shell script and SSH to each host to mount your NFS datastores.

vmware-vim-cmd:

vmware-vim-cmd hostsvc/datastore/nas_create [DISPLAY_NAME] [NFS_SERVER_IP] [MOUNT_PATH] [MODE(readwrite=1/readonly=0)]

(e.g.)
vmware-vim-cmd hostsvc/datastore/nas_create MY_NFS_DATASTORE 172.30.0.254 /nfs/mount/point 1

If you're looking to remotely do this, you can look at a management appliance by VMware called VIMA

You can use VI Perl Toolkit or the RCLI which provides remote utilities similar to that of the standard commands found on the ESX Service Console in the form of (vicfg-,esxcfg-)

You have much to choose from and depending where you want to kick it off and what environment you feel comfortable these are your options.

Good Luck

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

Reply
0 Kudos
vmmeup
Expert
Expert
Jump to solution

Use the VI Toolkit for windows it's very easy to perform tasks like this in powershell. Here is an example of how you can add NFS datastores to every host in a cluster, this could easily be used to all hosts or specific datacenters.

Sid Smith

-


VCP, VTSP, CCNA, CCA(Xen Server), MCTS Hyper-V & SCVMM08

  • Don't forget to award points for correct and helpful answers.

Sid Smith ----- VCP, VTSP, CCNA, CCA(Xen Server), MCTS Hyper-V & SCVMM08 [http://www.dailyhypervisor.com] - Don't forget to award points for correct and helpful answers. 😉
baltar
Contributor
Contributor
Jump to solution

Thank you both for your input!

Reply
0 Kudos