Search code examples
vmwareesxipyvmomi

Pyvmomi configure ESXi 'NTP Client Enabled' check box


Using the below code its possible to update the start up policy of ntpd service in an ESXi server,

con = connect.SmartConnect(host=host, user=user, pwd=pwd)
content = con.RetrieveContent()
cv = content.viewManager.CreateContainerView(
        container=content.rootFolder, type=[vim.HostSystem], recursive=True)

for child in cv.view:
    child.configManager.serviceSystem.UpdatePolicy(id='ntpd', policy='on')

There is no clue in the service

(vim.host.Service) {
dynamicType = <unset>,
dynamicProperty = (vmodl.DynamicProperty) [],
key = 'ntpd',
label = 'NTP Daemon',
required = false,
uninstallable = false,
running = false,
ruleset = (str) [
  'ntpClient'
],
policy = 'off',
sourcePackage = (vim.host.Service.SourcePackage) {
  dynamicType = <unset>,
  dynamicProperty = (vmodl.DynamicProperty) [],
  sourcePackageName = 'esx-base',
  description = 'This VIB contains all of the base functionality of 
  vSphere ESXi.'
  }
}

But how to mark the NTP Client Enabled check box for ESXi using Pyvmomi?

enter image description here

VMware version - 6.0.0


Solution

  • host.configManager.firewallSystem.EnableRuleset(id='ntpClient')