Get-OMEProfile | Delete-OMEProfile | Invoke-OMETemplateDeploy
nebb00 opened this issue · 3 comments
Do you have a function to support grabbing the existing OME Profiles and deleting. I see you have functions to Detach and Unassign profiles. Although not sure on the difference as the descriptions are the same. Would love to do the following;
- Identify if device has a profile
- Unassign/detach profile from device
- Delete leftover profile
- Either create profile, or permit Invoke-OMETemplateDeploy to name the new profile it creates.
Sorry if this is duplicated and already exists
Detach and Unassign are the same thing. OME and OME-M have different API endpoints for this.
I will work on creating commandlets for Get-OMEProfile
and Remove-OMEProfile
. I'll look into Profile naming as well.
I'm not a fan of the 1-to-1 mapping of Templates to Devices. This was a change that came with the MX platform. We used to be able to deploy as many Templates to devices as we wanted. Another method to do this is to deploy Templates to iDRACs directly, outside of OME. Tex has some commandlets that communicate with the iDRAC directly without this limitation. You could store your Templates in a git repo instead of OME since they are just XML/JSON files. Then you can deploy as many Templates as you want without worrying about Profiles. Something to consider...
https://www.powershellgallery.com/packages/IdracRedfishSupport
Detach and Unassign are the same thing. OME and OME-M have different API endpoints for this.
I will work on creating commandlets for
Get-OMEProfile
andRemove-OMEProfile
. I'll look into Profile naming as well.I'm not a fan of the 1-to-1 mapping of Templates to Devices. This was a change that came with the MX platform. We used to be able to deploy as many Templates to devices as we wanted. Another method to do this is to deploy Templates to iDRACs directly, outside of OME. Tex has some commandlets that communicate with the iDRAC directly without this limitation. You could store your Templates in a git repo instead of OME since they are just XML/JSON files. Then you can deploy as many Templates as you want without worrying about Profiles. Something to consider...
https://www.powershellgallery.com/packages/IdracRedfishSupport
Going direct to iDRAC is something i do right now, but was looking to simpilfy the workflow for unattended iso installs through OME as the broker. Problem I have is templates to devices is something I have to work with as I have MX platforms, so need to use that target. But also have standalone rackmounts, so need OME also.
I think I covered everything in https://github.com/dell/OpenManage-PowerShell-Modules/releases/tag/3.7.0
- Identify if device has a profile
# Get Profile Deployed Directly to Device
$Profile = Get-OMEProfile -Verbose | Where-Object { $_.ProfileName -eq "Profile from template 'MX740c_FC VLAN w IP' 00001" }
$DeviceId = $Profile.TargetId
$DeviceId
$Device = $DeviceId | Get-OMEDevice -FilterBy "Id"
$Device
# Get Profile Deployed to Chassis Slot
$Profile = Get-OMEProfile -Verbose | Where-Object { $_.ProfileName -eq "Profile from template 'MX740c_FC VLAN w IP' 00001" }
$DeviceSlotId = $Profile.DeviceIdInSlot
$Device = $DeviceSlotId | Get-OMEDevice -FilterBy "Id"
$Device
- Unassign/detach profile from device
# Unassign Profile by device
Invoke-OMEProfileUnassign -Device $("37KP0ZZ" | Get-OMEDevice) -Wait -Verbose
# Unassign Profile on multiple devices
$("37KP0ZZ", "37KT0ZZ" | Get-OMEDevice) | Invoke-OMEProfileUnassign -Wait -Verbose
# Unassign Profile by template
Invoke-OMEProfileUnassign -Template $("TestTemplate01" | Get-OMETemplate) -Wait -Verbose
# Unassign Profile by profile name and force reclaim identities
Invoke-OMEProfileUnassign -ProfileName "Profile from template 'TestTemplate01' 00001" -ForceReclaim -Wait -Verbose
- Delete leftover profile
"TestProfile01" | Get-OMEProfile | Remove-OMEProfile
- Either create profile, or permit Invoke-OMETemplateDeploy to name the new profile it creates.
So you can't dictate the Profile name when Deployed from a Template. However you can create a new Profile and specify the name.
# Create a new Profile from a Template
"Test Template 01" | Get-OMETemplate | New-OMEProfile -NamePrefix "Test Profile" -NumberOfProfilesToCreate 3
# Create a new Profile from a Template and mount ISO from NFS share to Virtual Media
"Test Template 01" | Get-OMETemplate | New-OMEProfile -NamePrefix "Test Profile" -NumberOfProfilesToCreate 3 -NetworkBootShareType "NFS" -NetworkBootShareIpAddress "192.168.1.100" -NetworkBootIsoPath "/mnt/data/iso/OS.iso" -Verbose
# Assign Profile to Device
$Device = "933NCZZ" | Get-OMEDevice
"Test Profile 00001" | Get-OMEProfile | Invoke-OMEProfileAssign -TargetId $Device.Id -Verbose
Invoke-OMEProfileUnassign -ProfileName "TSTest 00001" -Wait -Verbose
# Assign Profile to Chassis Slot 1 and Apply Immediately ***This will force a reseat of the sled***
*See https://www.dell.com/support/kbdoc/en-us/000214041/mx7000-deploying-a-slot-based-template-shows-the-profile-as-assigned-and-virtual-identities-as-reserved
$Chassis = "933MCZZ" | Get-OMEDevice
$ChassisSlots = $Chassis | Get-OMEDeviceDetail -InventoryType "chassisSlotsList" | Select-Object -ExpandProperty InventoryInfo
$SlotId = $ChassisSlots | Where-Object { $_.Number -eq "1" -and $_.DeviceType -eq 1000 } | Select-Object -ExpandProperty Id
"Test Profile 00001" | Get-OMEProfile | Invoke-OMEProfileAssign -TargetId $SlotId -AttachAndApply -Wait -Verbose