Thursday, April 20, 2023

Dell EMC Virtual Appliance Manager 9.2.1 Installation Guide or unisphere vapp

 

Launching the vApp Manager

About this task

To launch the vApp Manager:

Steps

  1. Type one of the following URLs in a browser:
    • https://appliance_IP:unisphere_port_number
    • https://appliance_host_name:unisphere_port_number
    The default Unisphere port number is 5480.

    If the host IP address is an IPv6 address, surround the IP address with square brackets, for example:

    https://[2001:db8:ffff:ffff:ffff:ffff:ffff:ffff]:5480

    If the host IP address is an IPv4 address, type the IP address as normal, for example:

    https://198.51.100.255:5480

    For either of the URLs above, the browser is redirected, as shown in the following table.

    ORIGINAL URLREDIRECTED URL
    https://appliance_IP:unisphere_port_ numberhttps://appliance_IP:unisphere_port_ number/vappmgr/#/login
    https://appliance_host_name:unisphere_port_ numberhttps://appliance_IP:unisphere_port_ number/vappmgr/#/login
  2. On the log in panel, type seconfig for both the User and Password, and then click Login.
    The vApp Manager opens. For more information, see the vApp Manager online help.

Additional Information

SSH will need to be enabled after each reboot of the vApp. This is as designed.

The default credentials for SSH / CLI is cseadmin / cseadmin.

How to install Ansible on Centos7/RHEL

 How to install Ansible in Centos 7/RHEL 7?

$ sudo yum install wget -y
$ wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
$ yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
$ sudo rpm -i epel-release-latest-7.noarch.rpm
$ sudo yum update -y 
$ sudo yum install ansible -y
$ systemctl stop firewalld
$ systemctl disable firewalld

Install Ansible via Pip in RHEL/CENTOS


$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py --insecure
$ python get-pip.py 
$ pip --version
$ python get-pip.py
$ pip uninstall ansible
$ pip install ansible
$ ansible --version

Brocade config backup and supportsave commands

 Before doing any kind of changes to a Brocade FC switch it’s a good idea to backup its config first. We backup Brocade switches using the configupload command.

Prerequisites – The switches need an FTP server to backup to.  You will need to know the IP address of the FTP server and a user account with access to proceed.

1 Establish a putty session to the switch and login as normal

2 Enter the command

configupload

3 At the protocol selection prompt choose the protocol appropriate for you FTP server. Press enter to select the default FTP

Protocol (scp, ftp, sftp, local) [ftp]

4 At the IP Address prompt enter the IP address of the FTP server

Server Name or IP Address [host]: 10.10.10.5

5 User Name, enter a user with access

User Name [user]

6 Path/filename, press enter to accept the home directory or enter path

Path/Filename [<home dir>/config.txt]:

7 Section, press enter to select all components or enter the element to backup

Section (all|chassis|switch [all]):

8 Go to your FTP server and you should see a file called config.txt.  Rename this to something logical like the switch name and date

Below is an example of all the steps completed

FCSWITCH01:admin> configupload
Protocol (scp, ftp, sftp, local) [ftp]:
Server Name or IP Address [host]: 10.10.10.5
User Name [user]: anonymous
Path/Filename [<home dir>/config.txt]:
Section (all|chassis|switch [all]):

  1. Use the “supportsave” CLI command. Be aware: This needs an FTP server to be configured and running on a management workstation reachable by the switch!

Example:

 

Supportsave

 

This command will collect RASLOG, TRACE, supportShow, core file, FFDC data and other support information and then transfer them to a FTP/SCP server or a USB device. This operation can take several minutes.
..
..
OK to proceed? (yes, y, no, n): [no] y
Host IP or Host Name: xxx.xxx.xxx.xxx
User Name: YYYY
Password:
Protocol (ftp or scp):

 

Your FTP server will receive multiple files. Please compress them and give the resulting archive file a meaningful name. For example:

TicketNumber_SwitchName_Date_Description.zip

Brocade switch reboot process

 

Description

Use this command to perform a "cold reboot" (power off/restart) of the control processor. This operation may be disruptive, and the command prompts for confirmation before executing. When you reboot a switch connected to a fabric, all traffic to and from that switch stops. All Fibre Channel ports on that switch including E_Ports become inactive until the switch comes back online.
The behavior of this command depends on the platform:
  • When issued on a standalone (single-processor) switch, this command performs a cold reboot of the switch.
  • When issued on an enterprise-class platform (Brocade X6-4 Director or Brocade X6-8 Director) with two CPs (active and standby), the following rules apply:
    • When the Standby CP reboots, it goes down and there is no failover because there is no traffic on that switch. When the Standby CP comes up again, it is temporarily no longer in sync with the Active CP.
    • When the Active CP reboots, it fails over to the Standby CP. The Standby CP becomes the new Active CP and traffic is disrupted.
    • When HA is in sync, and 
      reboot -f
       is issued on the Active CP of a director, the Standby CP takes over as the active CP without traffic disruption. If HA is not in sync, and 
      reboot -f
       is issued on the Active CP, the Standby CP takes over as the Active CP and traffic is disrupted.
    • When HA is disabled and 
      reboot
       or 
      reboot -f
       is issued on the Active CP, both the Active and Standby CPs reboot with the original mastership retained. The original Active CP remains the Active CP after the reboot, and the original Standby CP remains the Standby CP. After the reboot, HA is enabled.
    • When HA is disabled and 
      reboot
       or 
      reboot -f
       is issued on the Standby CP, the Standby CP reboots without prompting. It boots up with the default switch only, even if the Active CP has multiple logical switches configured. After the Standby CP boots up, HA is still disabled.

Notes

This command is subject to Virtual Fabric restrictions that may be in place. See "Using Fabric OS Commands" and "Command Availability" for details.

Operands

-f
Causes the CP to fail over to the Standby CP without affecting any of the Fibre Channel Ports. Note that the recommended way to force a failover without affecting any Fibre Channel ports is to issue the 
haFailover
 command.

Examples

To reboot a standalone switch with a single CP:
switch:admin>
reboot
Warning: This command would cause the switch to reboot
and result in traffic disruption.
Are you sure you want to reboot the switch [y/n]?
y
Rebooting! Sun Feb 28 19:49:45 2010...
The system is going down for reboot NOW !!
To reboot a CP when HA is enabled:
switch:admin>
reboot
Warning: This command is being run on a control processor (CP)
based system and will cause the active CP to reboot.
Are you sure you want to reboot the active CP [y/n]?
y
Rebooting! Sun Feb 28 19:49:45 2010...
The system is going down for reboot NOW !!
To reboot a CP when 
haFailover
 is disabled:
switch:admin>
reboot
This command is being run on a control processor (CP)
based system. Because HA is disabled, it will cause both
active CP and the standby CP to reboot. After reboot, the
HA will be enabled.
Do you want to continue [y/n]
y
Rebooting! Sun Feb 28 19:49:45 2010...
The system is going down for reboot NOW !!

Tuesday, February 14, 2023

Azure Powershell commands

- To connect azure subscription from powershell.


Connect-AzAccount 

- if Connect-AzAccount does not connect properly use below command.

Connect-AzAccount -DeviceCode

WARNING: To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code D3DWL7T2R to authenticate.

- Type below command to check available subscription.

Get-AzSubscription

- To switch the subscription use below command.

Set-AzContext -Subscription {293caa52-ebff-42e6-9e6f-xxxxxxxx subscription id}

once you switch the subscription you can check resource of that subscription.


- Use below command to check resource group

Get-AzResourceGroup

use below to check formated info about resource group.

Get-AzResource | Format-Table

- use below command to create vm instance

New-AzVm -ResourceGroupName learn-6d075fba-929b-432a-89c7-xxxxxxx -Name "testvm-eus-01" -Credential (Get-Credential) -Location "eastus" -Image Canonical:0001-com-ubuntu-server-focal:20_04-lts:latest -OpenPorts 22 -PublicIpAddressName "testvm-01"




Wednesday, March 2, 2022

To change ESXi root user description via Vcenter Power cli.

 To change ESXi root user description via Vcenter Power cli.


# csv file should have heading with ESXi, username, password

$csv = Import-csv .\esxi.csv

foreach ($line in $csv)

{

Connect-VIServer -Server $($line.ESXi) -User $($line.username) -Password $($line.password) -WarningAction silentlyContinue


Get-VMHostAccount -User root | Set-VMHostAccount -Description admin6 -Confirm:$false | Out-Null -ErrorAction SilentlyContinue


Disconnect-VIServer -Server $($line) -Confirm:$false


}

Tuesday, February 1, 2022

Powershell script to collect VM info from Vcenter

# Script: ListVMs.ps1 - Ravi - 1st Feb 2022 
# Usage  : .\listvms <vcenter or host ip>:[Manadatory] <user>:[Manadatory] <password>:[Manadatory] <sortBy>:[Optional]
# Example: .\listvms 192.168.0.1 root mypassword ramalloc
#
# Desc   : Retrieves a list of virtual machines from an ESXi host or vCenter Server, extracting a subset of 
#          vm properties values returned by Get-View. The list is converted to HTML and written to disk. 
#          The script automatically displays the report by invoking the default browser.

#Command line parameters
[CmdletBinding()]
Param(
 [Parameter(Mandatory=$true,Position=1)]
 [string]$hostIP,
 
 [Parameter(Mandatory=$false,Position=2)]
 [string]$user,
 
 [Parameter(Mandatory=$false,Position=3)]
 [string]$pass,
 
 [Parameter(Mandatory=$false,Position=4)]
 [string]$sortBy
)

#Populate PSObject with the required vm properties 
function vmProperties
{
 param([PSObject]$view)
 
 $list=foreach ($vm in $view){
 
 #Get net info
  $ips=$vm.guest.net.ipaddress
  $macs=$vm.guest.net.MacAddress
 
 #State info
  if ($vm.Runtime.PowerState -eq "poweredOn") {$state="ON"}
   elseif ($vm.Runtime.PowerState -eq "poweredOff") {$state="OFF"}
    else {$state="n/a"}
 
 #VMtools state
  if ($vm.summary.guest.ToolsRunningStatus -eq "guestToolsRunning") {$vmtools="Running"}
   elseif ($vm.summary.guest.ToolsRunningStatus -eq "guestToolsNotRunning") {$vmtools="Not running"}
    else {$vmtools="n/a"}
 
 #Check for multi-homed vms - max. 2 ips
  if ($ips.count -gt 1)
  {$ips=$vm.guest.net.ipaddress[0] + " " + $vm.guest.net.ipaddress[1]} 
 
  if ($macs.count -gt 1)
   {$macs=$vm.guest.net.macaddress[0] + " " + $vm.guest.net.macaddress[1]} 
 
 #Populate object
 [PSCustomObject]@{
  "Name" = $vm.Name
  "Cluster" = ($vms | Get-Cluster).Name
  "OS" = $vm.Guest.GuestFullName
  "Hostname" = $vm.summary.guest.hostname
  "vCPUs" = $vm.Config.hardware.NumCPU
  "Cores" = $vm.Config.Hardware.NumCoresPerSocket
  "RAM Alloc" = $vm.Config.Hardware.MemoryMB
  "RAM Host" = $vm.summary.QuickStats.HostMemoryUsage
  "RAM guest" = $vm.summary.QuickStats.GuestMemoryUsage
  "NICS" = $vm.Summary.config.NumEthernetCards
  "vmtoolversion" = $vm.Config.Tools.ToolsVersion
  "IPs" = $ips
  "MACs" = $macs
  "vmTools" = $vmtools
  "State" = $state
  "UUID" = $vm.Summary.config.Uuid
  "VM ID" = $vm.Summary.vm.value
  }
 }
 
 return $list
}

#Stylesheet - this is used by the ConvertTo-html cmdlet
function header{
 $style = @"
 <style>
 body{
 font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
 }
 
 table{
  border-collapse: collapse;
  border: none;
  font: 10pt Verdana, Geneva, Arial, Helvetica, sans-serif;
  color: black;
  margin-bottom: 10px;
 }
 
 table td{
  font-size: 10px;
  padding-left: 0px;
  padding-right: 20px;
  text-align: left;
 }
 
 table th{
  font-size: 10px;
  font-weight: bold;
  padding-left: 0px;
  padding-right: 20px;
  text-align: left;
 }
 
 h2{
  clear: both; font-size: 130%;color:#00134d;
 }
 
 p{
  margin-left: 10px; font-size: 12px;
 }
 
 table.list{
  float: left;
 }
 
 table tr:nth-child(even){background: #e6f2ff;} 
 table tr:nth-child(odd) {background: #FFFFFF;}

 div.column {width: 320px; float: left;}
 div.first {padding-right: 20px; border-right: 1px grey solid;}
 div.second {margin-left: 30px;}

 table{
  margin-left: 10px;
 }
 –>
 </style>
"@

 return [string] $style
 }

#############################
### Script entry point ###
#############################

#Path to html report
 $repPath=(gci env:userprofile).value+"\desktop\test.htm"

#Report Title
 $title = "<h2>VMs hosted on $hostIP</h2>"

#Sort by
 if ($sortBy -eq "") {$sortBy="Name"; $desc=$False} 
  elseif ($sortBy.Equals("ramalloc")) {$sortBy = "RAM Alloc"; $desc=$True} 
   elseif ($sortBy.Equals("ramhost")) {$sortBy = "RAM Host"; $desc=$True} 
    elseif ($sortBy.Equals("os")) {$sortBy = "OS"; $desc=$False}

Try{
 #Drop any previously established connections
  Disconnect-VIServer -Confirm:$False -ErrorAction SilentlyContinue
 
 #Connect to vCenter or ESXi
  if (($user -eq "") -or ($pass -eq "")) 
   {Connect-VIServer $hostIP -ErrorAction Stop}
  else 
    {Connect-VIServer $hostIP -User $user -Password $pass -ErrorAction Stop}

 #Get a VirtualMachine view of all vms
  $vmView = Get-View -viewtype VirtualMachine
  $vms = Get-VM
 
 #Iterate through the view object, write the set of vm properties to a PSObject and convert the whole lot to HTML
  (vmProperties -view $vmView) | Sort-Object -Property @{Expression=$sortBy;Descending=$desc} | ConvertTo-Html -Head $(header) -PreContent $title | Set-Content -Path $repPath -ErrorAction Stop
 
 #Disconnect from vCenter or ESXi
  Disconnect-VIServer -Confirm:$False -Server $hostIP -ErrorAction Stop
 
 #Load report in default browser
  Invoke-Expression "cmd.exe /C start $repPath"
 }
Catch
 {
  Write-Host $_.Exception.Message
 }