Adding Users using vMA
While going through one of the task i run few commands to create users on ESXi through vMA so thought of sharing the same on the page i dedicated for commands.
To add user make sure that we have already added the ESXi as server target in vMA and you are connected to the same.
vifp addserver servername --authpolicy fpauth --username
Once ESXi has been added as a server target let's get connected with ESXi using the command.
vifptarget -s servername
Now it's time to add the user using the below command and specify the password twice
vicfg -user -e user -o add -l (name of the user)
Now when the user has been successfully added we can view if the recently created user exists by running the below command.
vicfg -user -e user -o list
For modifications of the recently created user we can run below command.
vicfg -user -e user -o modify -l
------------------------------------------------------------------------------------------------------
Configuring NTP using PowerCLI
Thanks to one of my team mate for asking some command line questions which made me dig deeper and try to find out how to work with ntpd service using command line.
Though we have already seen how we can configure NTP settings for an ESXi when managed from vMA in our last blog post configuring NTP settings but how exactly
it works through Powercli Let's have a look.
1) Connecting to your ESXi
Connect-VIServer (name of your ESXi host)
2) While Connecting it will prompt you for username and password specify the username and password for ESXi.
Add-VmHostNtpServer -VMHost $esx -NtpServer servername
4) To check if NTP is configured Properly
Get-VMHostNtpServer
----------------------------------------------------------------------------------------------
ESXi reference Poster
While working on command line these days find one of the useful poster which describes some useful host, VM and network commands.
Though its an old poster but helped me in understanding and running commands while working with command line so thought of sharing the same.
To download refer https://blogs.vmware.com/vsphere/2012/09/vmware-posters.html#VMwareESXi5.1ReferencePoster
-----------------------------------------------------------------------------------------------------------
ADD vMA instance to Domain
sudo domainjoinf-cli query
Above query command can help us identify the domain is properly joined or not.
sudo domainjoinf-cli leave
Above leave command will help us in leaving the vMA from domain.
------------------------------------------------------------------------------------------------------
Configuring NTP settings.
In our last post mentioned below we understood software and hardware requirements for vMA and also added ESXi hosts and vCenter servers as server target.
Here we will understand how we can configure NTP settings through vMA by using (vicfg ) commands.
1 ) Setting ESXI host as the current server target using.
vifptarget -s server (Replace Server with ESXi FQDN)
2) List if any NTP servers are already configured on ESXI using below command.
vicfg-ntp -- list
If no NTP servers are configured you will see information like below.
vicfg-ntp -- stop
4) Add the NTP server
vicfg-ntp -- add server (replace server with your NTP server address)
5) After the NTP server has been added start NTP service
vicfg-ntp -- start
6) Again run the list command to ensure the NTP servers has been added properly
vicfg-ntp -- list
Based on the NTP server details you have added you will see output similar to screenshot below.
For More information refer www.vmware.com/support/pubs
-----------------------------------------------------------------------------------------------------------------
Common question asked in almost every class that i deliver is how can we manage our vSphere infrastructure from command line?
So thought of dedicating a page for command line management of vSphere infrastructure.
Will start the discussion with vSphere Management Assistant which allows administrators and developers to run scripts and agents to manage ESXi hosts and vCenter Server systems.
vMA is a virtual machine that includes prepackaged software such as a Linux distribution, the vSphere command‐line interface, and the vSphere SDK for Perl.
As administrator, we can add vCenter Server systems and ESXi hosts as targets and run scripts and
programs on these targets.
As a developer, we can use the APIs provided with the VmaTargetLib library to programmatically
connect to vMA targets by using Perl or Java.
vMA Component Overview
When we install vMA, we are licensed to use the virtual machine that includes all vMA components such as.
- SUSE Linux Enterprise Server 11 SP1 – vMA runs SUSE Linux Enterprise Server on the virtual machine.
- VMware Tools – Interface to the hypervisor
- vSphere CLI – Commands for managing vSphere from the command line
- vSphere SDK for Perl . The SDK includes utility applications and samples for many common tasks.
- Java JRE version 1.6 – Runtime engine for Java‐based applications built with vSphere Web Services SDK.
- vi‐fastpass ‐ Authentication component.
Hardware and Software Requirements
To set up vMA, we must have an ESXi host. Because vMA runs a 64‐bit Linux guest operating system, the ESXi host on which it runs must support 64‐bit virtual machines.
By default, vMA uses one virtual processor, and requires 3GB of storage space for the vMA virtual disk. The
recommended memory for vMA is 600MB.
We can deploy vMA on the following systems: vSphere 4.1 and later, vSphere 5.0, vSphere 5.1 and later vCenter Application 5.0 and later.
Deployment and Configuration
Before proceeding further with the configuration of vMA ensure we have the username and password for vCenter, Esxi host and vMA.
To deploy vMA vSphere client can be used by selecting file > Deploy OVF Template or can be directly downloaded from URL.
Post deployment we need to configure network settings (IP,hostname,DNS etc) and also specify the password for vi-admin for vMA during first boot.
Note- vMA provides two consoles vMA console for (adding servers to vMA,running commands and configuring network/time related settings) and Web UI for (updating vMA,configuring network/time/proxy settings) we will be dealing with vMA console.
1) Login as vi-admin and provide the password we specified during first boot.
2) Running few help commands like esxcli --help , vifp --help , vifptarget --help
vifp addserver servername --authpolicy fpauth --username root
4) Also add ESXi hosts as a server target using the same command by specifying the host name,username and password for your ESXi hosts.
vifp addserver servername --authpolicy fpauth --username root
5) Once the server target has been we can run the command vifp listservers command to verify whether it has been added properly or not.
As of now we understood the installation/configuration of vMA and also talked about how to add server target in vMA.
For further information refer www.vmware.com/support/pubs
vifp addserver servername --authpolicy fpauth --username root
5) Once the server target has been we can run the command vifp listservers command to verify whether it has been added properly or not.
As of now we understood the installation/configuration of vMA and also talked about how to add server target in vMA.
For further information refer www.vmware.com/support/pubs
Very informative... Helps a lot.....
ReplyDeleteThanks Arunabha
Delete