def connect_host(kwargs=None, call=None):
 if (call != 'function'):
  raise SaltCloudSystemExit('The connect_host function must be called with -f or --function.')
 host_name = (kwargs.get('host') if (kwargs and ('host' in kwargs)) else None)
 if (not host_name):
  raise SaltCloudSystemExit('You must specify name of the host system.')
 si = _get_si()
 host_ref = salt.utils.vmware.get_mor_by_property(si, vim.HostSystem, host_name)
 if (not host_ref):
  raise SaltCloudSystemExit('Specified host system does not exist.')
 if (host_ref.runtime.connectionState == 'connected'):
  return {host_name: 'host system already connected'}
 try:
  task = host_ref.ReconnectHost_Task()
  salt.utils.vmware.wait_for_task(task, host_name, 'connect host', 5, 'info')
 except Exception as exc:
  log.error('Error while connecting host {0}: {1}'.format(host_name, exc), exc_info_on_loglevel=logging.DEBUG)
  return {host_name: 'failed to connect host'}
 return {host_name: 'connected host'}

def connect_host ( kwargs = None , call = None ) : if ( call != 'function' ) : raise SaltCloudSystemExit ( 'The connect_host function must be called with -f or --function.' ) host_name = ( kwargs . get ( 'host' ) if ( kwargs and ( 'host' in kwargs ) ) else None ) if ( not host_name ) : raise SaltCloudSystemExit ( 'You must specify name of the host system.' ) si = _get_si ( ) host_ref = salt . utils . vmware . get_mor_by_property ( si , vim . HostSystem , host_name ) if ( not host_ref ) : raise SaltCloudSystemExit ( 'Specified host system does not exist.' ) if ( host_ref . runtime . connectionState == 'connected' ) : return { host_name : 'host system already connected' } try : task = host_ref . ReconnectHost_Task ( ) salt . utils . vmware . wait_for_task ( task , host_name , 'connect host' , 5 , 'info' ) except Exception as exc : log . error ( 'Error while connecting host {0}: {1}' . format ( host_name , exc ) , exc_info_on_loglevel = logging . DEBUG ) return { host_name : 'failed to connect host' } return { host_name : 'connected host' }
connect the specified host system in this vmware environment cli example: .