In the vSphere Web Client, I can set the workload DNS servers and the workload NTP servers of a Supervisor Cluster.
With Enable-WMCluster/Set-WMCluster and the -WorkerDnsServer parameter, I can set the workload DNS servers, but there is no parameter for the workload NTP servers.
After some digging, I found a setter method in the WMCluster object. But both,
$WMCluster = Get-WMCluster -Cluster 'ClusterDisplayName'
$WMCluster.ExtensionData.Data.SetWorkloadNtpServers('8.8.8.8')
and
$WMCluster = Get-WMCluster -Cluster 'ClusterDisplayName'
$WMCluster.ExtensionData.Data.SetWorkloadNtpServers('8.8.8.8')
$WMCluster | Set-WMCluster
do not seem to actually set the workload NTP servers.
So, how can I set the workload NTP servers of a Supervisor Cluster programmatically?
Hi @stackprotector ,
Setting the workload Ntp servers is a little more complicated, since it's not in the Set-WMCluster cmdlet you need to use the lower level (Cis) Api, like this:
$WMCluster = Get-WMCluster -Cluster 'ClusterDisplayName'
# Connect-CisServer <use vCenter's name/IP and credentials>
$clustersApi = Get-CisService com.vmware.vcenter.namespace_management.clusters
$clusterId = $WMCluster.Cluster.ExtensionData.MoRef.Value
$spec = $clustersApi.Help.update.spec.Create()
$spec.workload_ntp_servers = $clustersApi.Help.update.spec.workload_ntp_servers.Create()
$spec.workload_ntp_servers.Add("8.8.8.8")
$clustersApi.update($clusterId, $spec)
Regards,
Angel
Thanks for that info @aevrov
Out of curiosity, could the same be achieved with the Initialize-NamespaceManagementClustersSetSpec -WorkloadNtpServers ... and one of the Invoke-SetCluster... or Invoke-UpdateCluster... cmdlets?
I looked at those, but the Help on those cmdlets is very restricted, not to say non-existing
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi @LucD ,
Yes, the same should be possible with this interface too.
Here's a reference of the update operation with example: https://developer.vmware.com/apis/vsphere-automation/latest/vcenter/api/vcenter/namespace-management...
Regards,
Angel
Thanks, I saw that one.
My problem is that with the cmdlets all parameters seem to be "required" while with the CIS service, as you showed, it is a bit more user friendly 😉
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference