Milestone #4: vCenter AD Integration, PowerCLI and Linked Clones - wAlber47/Tech-Journal GitHub Wiki
Leveraging AD with vSphere
For this, we are going to use our Active Directory accounts in order to log in to vSphere.
To start, go to Menu -> Administration, then find Single Sign On Configuration.
From there, head to Active Directory Domain and follow the steps to join the domain. Once joined, we have to reboot vCenter. To do this, go to Deployment, then select the alber.local
node.
This can also be done from the Management Interface, (using port 5480). Then select Actions -> Reboot. This will take some time.
Now, we are going to associate a group on Active Directory with a user group on vCenter. Meaning that members of the Domain Admins group in Active Directory will be part of the Administrator group of vCenter.
Before adding in our groups, we need to set the domain as an identity source. To do this, go back to the configuration menu that were accessed earlier. The settings should look like this, make sure to set it as default:
Head to Users and Groups, then select Groups, find the Administrators group. Now click Add a Member, but instead of choosing vsphere.local, select our local domain. Then search Domain and add the Domain Admins like this:
We should now be able to log in as a named Domain Administrator.
Licensing vCenter & vSphere
Going to license vCenter and vSphere (super4) in this section of the Milestone.
vCenter Licensing
Fairly straightforward, follow the steps as follows:
- Right Click on
vcenter.alber.local
within vSphere client. - Select the Add a License button, then New License.
- Copy the vCenter Key into the box. After doing this, everything should be populated.
- Change the License Name to
vCenter-480-F21
.
vSphere
Fairly straightforward, follow the steps as follows:
- Open up the hierarchy menu until super4 is visible.
- Right Click on
super4
within vSphere client. - Select the Add a License button, then New License.
- Copy the vSphere Key into the box. After doing this, everything should be populated.
- Change the License Name to
super4-480-F21
. This license will apply to eight differentsuperX
systems.
This should prevent the licensing warnings from popping up in the future.
CentOS 7 Base Image
We are going to create a CentOS 7 image, similar to how we create a Windows base image.
To start, download the CentOS-7-x86_64-2009.iso
file from rackstation. Place this file within the larger datastore. If an error pops up, open super4 and attempt the download again.
Once it uploads, we are going to create a new virtual machine using this ISO. Name this VM centos7.2009.base
. Place this Virtual Machine on the larger datastore*. Set it compatible to 6.5. Set it to Linux and CentOS 7.
For the Hardware Configuration:
Double check that Thin Provisioning is enabled. Also, make sure that the CentOS 7 ISO is in the CD Drive and is connected. We can now Finish.
We'll now Power On and follow the installation settings. There are some things to change when setting up the Machine:
- Installation Source: 16GB Disk
- Software Selection: Infrastructure Server
- Set the User as
deployer
and make them an Administrator.
After setting that, let installation proceed as normal. Reboot when prompted.
Once logged in, go to nmtui
and select Connect Automatically. Then run yum update -y
. After updated, run yum clean all
to clear out the yum cache.
Now that everything is updated, we are going to generalize the system to prepare it.
We will run a sys-unconfig
command to essentially sysprep it. Once this completes, (powers off), we'll begin to clone the system. Before that, remove the ISO Image from the virtual machine and create our Base Snapshot.
Powershell & PowerCLI
To start out, install Powershell onto xubuntu-wan
using sudo snap install Powershell --classic
. This will take some time.
Once installed, to get to Powershell run pwsh
.
From here, we will install PowerCLI using:
Install-Module VMWare.PowerCLI -Scope CurrentUser
This may also take some time. Once it is done we will be able to user PowerCLI from xUbuntu.
By default, PowerCLI will look for a valid Certificate from vCenter. Instead of taking the time to set up a certificate authority we run this command:
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore
Now we will connect to vCenter from the command line:
Connect-VIServer -Server vcenter.alber.local
Creating Linked Clones
We are going to use the CentOS base image that we created to create a linked clone to run Fog off of.
To do this, we follow these commands:
$base_vm = Get-VM -Name centos7.2009.base
$snapshot = Get-Snapshot -VM $base_vm -Name "Base"
$vmhost = Get-VMHost -Name super4.cyber.local
$dstore = Get-Datastore datastore2-super4
- Now we have the variables and can create the new VM.
$newvm = New-VM -Name "fog" -VM $base_vm -LinkedClone -ReferenceSnapshot $snapshot -VMHost $vmhost -Datastore $dstore
-
Then follow this to set the Network Adapter:
-
Finally, run
$newvm | Start-VM
to start the Virtual Machine.
From here, the steps are complete, last thing is to check that fog received a DHCP address. As it should have been given 10.0.17.101
.