PowerShell iControlスナップインを使用して、スタンバイF5 LTMホストへの変更を自動化しています。iControl PowerShellスナップインを使用してF5 LTMに保留中の変更があるか確認します。
私たちのオートメーションが変更を加える前に、スタンバイとライブのF5ホストの間に保留中の変更があるかどうかをプログラムで確認する必要があります。
iControlスナップインまたはAPIを通じて保留中の変更を確認する方法はありますか?
PowerShell iControlスナップインを使用して、スタンバイF5 LTMホストへの変更を自動化しています。iControl PowerShellスナップインを使用してF5 LTMに保留中の変更があるか確認します。
私たちのオートメーションが変更を加える前に、スタンバイとライブのF5ホストの間に保留中の変更があるかどうかをプログラムで確認する必要があります。
iControlスナップインまたはAPIを通じて保留中の変更を確認する方法はありますか?
iControl wikiの答えが見つかりました。 get_sync_status_overview()
方法は、「それがメンバーであるすべてのデバイスグループに現在のデバイスのプレゼンスのステータスを取得し、」
ウィキ参照:私は他の人が役立つことをPowerShellで次の関数を書いた https://devcentral.f5.com/wiki/iControl.Management__DeviceGroup__SyncStatus.ashx
同じ種類の操作を試みるとき デバイスがスタンドアロンまたはグループ内のデバイスと同期している場合はtrueを返します。グループに同期する必要のあるF5ホストの変更がある場合はfalseを返し、それ以外の場合はエラーをスローします。
function Is-DeviceInSync
{
<#
.SYNOPSIS
Gets the sync status of F5 devices within the device group
#>
$syncStatus = (Get-F5.iControl).ManagementDeviceGroup.get_sync_status_overview()
if ($syncStatus.member_state -eq "MEMBER_STATE_STANDALONE")
{
write-host "This F5 device is standalone, no sync is required"
return $true
}
elseif ($syncStatus.member_state -eq "MEMBER_STATE_IN_SYNC")
{
write-host "This F5 device is in sync with members of its device group, no sync is required"
return $true
}
elseif ($syncStatus.member_state -eq "MEMBER_STATE_NEED_MANUAL_SYNC")
{
write-host "This F5 device is not standalone and changes have been made to this device that have not been synced to the device group"
return $false
}
elseif ($syncStatus.member_state -eq "MEMBER_STATE_SYNCING")
{
write-host "This F5 device is currently synching with devices in it's group, waiting 10 seconds before checking again..."
Start-Sleep -Seconds 10
Is-DeviceInSync
}
else
{
throw "This F5 device is not in a stable sync state with devices in it's group, please manually verify the sync state of this device before running this script again"
}
}
注:この関数は、Initialize-F5.iControl関数が実行され、ユーザーが既にF5ホストに対して認証されていることを前提としています。