How to manage Aria LifeCycle (VRLCM 8.2) using Python

Life cycle manager is awesome tool and their APIs are easy to use and understand .
I have tried almost 30+ api and I feel it is good and Handy way to check the details and perform basic operation using python and API

Here is the List the Task which we can run using Python commands

  1. Get DNS server details
  2. Get DataCenter Details
  3. Create New DataCenter
  4. Update DataCenter Details like Rename or Location change
  5. Remove DataCenter
  6. Get DataCenter vCenter details
  7. Trigger DataCollection for vCenter
  8. Validate vCenter
  9. Create New vCenter under DataCenter
  10. Delete vCenter
  11. Perform Health check of Life Cycle Manager
  12. Get FIPS status
  13. Set FIPS status
  14. Get Passwords
  15. Create New Password
  16. Delete Password
  17. Edit Passwords
  18. Get Password More Info
  19. Get Password referenced Environment details
  20. Get All Environments
  21. Rename Environment
  22. Trigger Inventory sync for one Environment
  23. Trigger Inventory sync for All Environment
  24. Trigger Inventory sync for Product
  25. Get Product VMs
  26. Create snapshot of Product
  27. Get snapshot details or Product
  28. Check SSH status of Life Cycle Manager(LCM) appliance
  29. Enable/ Disable SSH for Life Cycle Manager(LCM) appliance
  30. Get System Details
  31. Get Disk Utilization details
  32. Expand Data Disk for Life Cycle Manager(LCM) appliance

There are some pre-requisite before we can use these python commands

  1. Please follow the detailed instruction here python installation and required module before we use this module -do not skip this step.
  2. Download the file and unzip and copy the file by name vRLCM82 and paste the file in directory where python is installed.
  3. General path in windows is:  C:\Users\Administrator\AppData\Local\Programs\Python\Python39
  4. I am using Python 3.9 for example ,It will be different as per your version.
  5. Once the step 1-3 is completed , all we need to do is launch the Python IDLE from task bar

Once IDLE is launched , The initial screen will look like this.

Before we start running the commands we need to load the module/package and Initialize the class.

from vRLCM import vrLCM
as11 = vrLCM(vrlcmurl='vrlcm82.vmwarecode.com',userName='admin@local',password='VMware123!')

If you have followed the article without skipping anything , that means you are ready to use the python commands.

  1. Get DNS server details
as11.lcmGetDNSServer()

2. Get DataCenter Details

as11.lcmGetDC()

3. Create New DataCenter
Parameters:
namedc : — Enter Name of the datacenter
location :- Enter location

as11.lcmNewDC(namedc='Ankush', location='Bangalore;Karnataka;IN;12.97194;77.59369')

4. Update DataCenter Details like Rename or Location change
Parameters:
namedc : — Enter Name of the datacenter
location :- Enter location
dcvmid : – We can get from command 2 -Get Datacenter

Note: I have taken the dcvmid from Command 3 in this example – you can run command 2 (as11.lcmGetDC()) to list all Datacenters

as11.lcmSetDC(dcvmid='fe1aa91a-8f74-4402-9c0f-c4b5f3664f0f', nameDC='AnkushS', location='Bangalore;Karnataka;IN;12.97194;77.59369')

5. Remove DataCenter
Paremeters:
dcvmid -We can get from command 2 -Get Datacenter
Note: I have taken dcvmid from Command 3 in this example – you can run command 2 (as11.lcmGetDC()) to list all Datacenters

as11.lcmRemoveDC(dcvmid='fe1aa91a-8f74-4402-9c0f-c4b5f3664f0f')

6. Get DataCenter vCenter details
Paremeter:
dcvmid -We can get from command 2 -Get Datacenter

as11.lcmGetDCvCenters(dcvmid='93bb2cb4-2b47-461f-892a-0a7ff32beec0')

7. Trigger DataCollection for vCenter
Parameters:
dcvmid–We can get from command 2 -Get Datacenter
vcname–we can get the alias of vCenter from command 6

as11.lcmTriggerDataCollection(dcvmid='93bb2cb4-2b47-461f-892a-0a7ff32beec0',vcname='VCSA1')

8. Validate vCenter

Parameters:
dcvmid:–DataCenter ID , we can grab from command 2
vcname–Provide Alias Name
vcHostName–FQDN of vCenter
vcPassword–Sample:
locker:password:5572c7ea-887e-4915-9711-d49f4826da41:installervCenter
Grab ID from Get password Command 14 and installervCenter is Alias
vcUsedAs–Provide details like WORKLOAD/MANAGEMENT/MANAGEMENT_AND_WORKLOAD
vcUserName— UserName of vCenter

Note: Existing details vCenter Name and vCenterHostName and Password I have got from Command 6

In below highlighted ID you can grab from command 14 (Get password), In case you want to supply new password

as11.lcmValidatevCenter(dcvmid='93bb2cb4-2b47-461f-892a-0a7ff32beec0', vcname='VCSA1', vcHostName='vcsa1.vmwarecode.com',vcPassword='locker:password:5572c7ea-887e-4915-9711-d49f4826da41:installervCenter', vcUsedAs='MANAGEMENT_AND_WORKLOAD', vcUserName='administrator@vsphere.local')

9. Create New vCenter under DataCenter
Parameters
dcvmid–DataCenter ID , we can grab from command 2
vcname— Provide Alias Name
vcHostName— Provide vCenter FQDN
vcPassword— Sample:
locker:password:5572c7ea-887e-4915-9711-d49f4826da41:installervCenter
Grab ID from Get password Command 14 and installervCenter is Alias
vcUsedAs— Provide details like WORKLOAD/MANAGEMENT/MANAGEMENT_AND_WORKLOAD
vcUserName–Provide the username

as11.lcmCreatevCenter(dcvmid='93bb2cb4-2b47-461f-892a-0a7ff32beec0', vcname='VCSA2', vcHostName='vcsa2.vmwarecode.com',vcPassword='locker:password:5572c7ea-887e-4915-9711-d49f4826da41:installervCenter', vcUsedAs='WORKLOAD', vcUserName='administrator@vsphere.local')

10 Delete vCenter
Parameters:
dcvmid–DataCenter ID, we can get from command 2
vcname— Provide the Alias name which was used during the add –to check the existing run command 6

as11.lcmDeletevCenter(dcvmid='93bb2cb4-2b47-461f-892a-0a7ff32beec0',vcname='VCSA2')

11. Perform Health check of Life Cycle Manager

as11.lcmHealthcheck()

12. Get FIPS status

as11.lcmGetFipsStatus()

13. Set FIPS status
Note: Changing the FIPS state will restart the services

as11.lcmSetFIps(Enable='false')

14. Get Passwords

as11.lcmGetPasswords()

15. Create New Password
Parameters:
alias–Provide alias name for password
password— Provide password
username— Provide UserName
passwDesription— Provide description of password

as11.lcmCreatePassword(alias='Ankush',password='ankush@123',username='as@vmwarecode.com',passwDesription='This is for test')

16. Delete Password

Parameter:
vmid–It can be retrieved from command 14 Get passwords

as11.lcmDeletePassword(vmid='b3af53af-9644-4d79-9960-15682075729e')

17. Edit Passwords
Parameters:
alias— Provide the name of the aliad
password— Provide the password
username— Provide the username
passwDesription–Provide description
vmid— Get the vmid from get password , command 14

as11.lcmEditPassword(alias='AS11',password='VMwareCode11',username='as@vmwarecode.com',passwDesription='This is for Binary download',vmid='34adae8e-4813-493e-86f8-aca3c77d07e6')
Took vmid from Get password

18. Get Password More Info
Parameter:
vmid— We can get from Get password command-14

as11.lcmGetPasswordInfo(vmid='a87841c8-24c9-4516-a4fb-087f4eb65679')

19. Get Password referenced Environment details
Parameter:
vmid— We can get from Get password command-14

as11.lcmGetPwdReferEnvironment(vmid='d16769b6-24c4-441b-9bbe-7a10efa4b9ac')

20. Get All Environments

as11.lcmGetAllEnvironment()

21.Rename Environment
Parameters:
envid:–We can get from Command 20- Get Environment
envname :– Provide new Name for environment

as11.lcmSetEnvironmentName(envid='c2cf3afe428825379b1f59f6',envname='VMwareCode2021')

22. Trigger Inventory sync for one Environment
Parameters:
envid:–We can get from Command 20- Get Environment

as11.lcmTriggerInventorySncEnv(environmentId='c2cf3afe428825379b1f59f6')

23. Trigger Inventory sync for All Environment

as11.lcmTriggerInventorySncAllEnv()

24. Trigger Inventory sync for Product
Parameters:
environmentId— We can get from Command 20- Get Environment
productId–We can get from Command 20- Get Environment

as11.lcmTriggerInventorySyncProduct(environmentId='globalenvironment',productId='vidm')

25. Get Product VMs
Parameters:
environmentId— We can get from Command 20- Get Environment
productId–We can get from Command 20- Get Environment

as11.lcmGetProductVMs(environmentId='globalenvironment', productId='vidm')

26. Create snapshot of Product
Parameters:
environmentId–We can get from Command 20- Get Environment
productId–We can get from Command 20- Get Environment
snapshotName–Enter Snapshot name
snapshotWithMemory–False/True

as11.lcmCreateSnapshotProduct(environmentId='globalenvironment', productId='vidm',snapshotName='VMwareCode-Test',snapshotWithMemory='False')

27.Get snapshot details or Product
Parameters:
environmentId–We can get from Command 20- Get Environment
productId–We can get from Command 20- Get Environment

as11.lcmGetSnapshotdetailsProduct(environmentId='globalenvironment', productId='vidm')

28. Check SSH status of Life Cycle Manager(LCM) appliance

as11.lcmGetSSHStatus()

29. Enable/ Disable SSH for Life Cycle Manager(LCM) appliance
Parameter:
enable-True/False

as11.lcmSeTSSH(enable='True')

30. Get System Details

as11.lcmGetSystemDetails()

31. Get Disk Utilization details

as11.lcmGetSystemDiskDetails()

32. Expand Data Disk for Life Cycle Manager(LCM) appliance
Parameters:
diskSizeInGb–Enter disk size in GB
vCenterHost–Enter vCenter name where LCM vm is hosted
vcPassword–Enter the password of the vCenter
vcUsername–Enter the username of the vCenter

as11.lcmExpandDiskSize(diskSizeInGb=1, vCenterHost='vcsa1.vmwarecode.com', vcPassword='VMware123!', vcUsername='administrator@vsphere.local')

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a website or blog at WordPress.com

%d bloggers like this: