VMwareV2 Deprecated

Manage VMware vSphere Server, Guests, and ESXi Hosts. Deprecated. Use Ansible VMware (from the Ansible VMware pack) instead.

IT Services · Ansible Powered Integrations (Deprecated)

Details

IDVMwareV2
ProviderBroadcom
CategoryIT Services
From Version6.0.0
Docker Imagedemisto/ansible-runner:1.0.0.21184
Supported ModulesAgentix

Configuration parameters

  • hostname — Hostname (required)
  • port — Port (required)
  • username — Username (required)
  • password — Password (required)
  • validate_certs — Validate Certs (required)

Commands (116)

  • vmware-about-info

    Provides information about VMware server to which user is connecting to

  • vmware-category

    Manage VMware categories

  • vmware-category-info

    Gather info about VMware tag categories

  • vmware-cfg-backup

    Backup / Restore / Reset ESXi host configuration

  • vmware-cluster

    Manage VMware vSphere clusters

  • vmware-cluster-drs

    Manage Distributed Resource Scheduler (DRS) on VMware vSphere clusters

  • vmware-cluster-ha

    Manage High Availability (HA) on VMware vSphere clusters

  • vmware-cluster-info

    Gather info about clusters available in given vCenter

  • vmware-cluster-vsan

    Manages virtual storage area network (vSAN) configuration on VMware vSphere clusters

  • vmware-content-deploy-template

    Deploy Virtual Machine from template stored in content library.

  • vmware-content-library-info

    Gather information about VMware Content Library

  • vmware-content-library-manager

    Create, update and delete VMware content library

  • vmware-datacenter

    Manage VMware vSphere Datacenters

  • vmware-datastore-cluster

    Manage VMware vSphere datastore clusters

  • vmware-datastore-info

    Gather info about datastores available in given vCenter

  • vmware-datastore-maintenancemode

    Place a datastore into maintenance mode

  • vmware-dns-config

    Manage VMware ESXi DNS Configuration

  • vmware-drs-group

    Creates vm/host group in a given cluster.

  • vmware-drs-group-info

    Gathers info about DRS VM/Host groups on the given cluster

  • vmware-drs-rule-info

    Gathers info about DRS rule on the given cluster

  • vmware-dvs-host

    Add or remove a host from distributed virtual switch

  • vmware-dvs-portgroup

    Create or remove a Distributed vSwitch portgroup.

  • vmware-dvs-portgroup-find

    Find portgroup(s) in a VMware environment

  • vmware-dvs-portgroup-info

    Gathers info DVS portgroup configurations

  • vmware-dvswitch

    Create or remove a Distributed Switch

  • vmware-dvswitch-lacp

    Manage LACP configuration on a Distributed Switch

  • vmware-dvswitch-nioc

    Manage distributed switch Network IO Control

  • vmware-dvswitch-pvlans

    Manage Private VLAN configuration of a Distributed Switch

  • vmware-dvswitch-uplink-pg

    Manage uplink portproup configuration of a Distributed Switch

  • vmware-evc-mode

    Enable/Disable EVC mode on vCenter

  • vmware-folder-info

    Provides information about folders in a datacenter

  • vmware-guest

    Manages virtual machines in vCenter

  • vmware-guest-boot-info

    Gather info about boot options for the given virtual machine

  • vmware-guest-boot-manager

    Manage boot options for the given virtual machine

  • vmware-guest-custom-attribute-defs

    Manage custom attributes definitions for virtual machine from VMware

  • vmware-guest-custom-attributes

    Manage custom attributes from VMware for the given virtual machine

  • vmware-guest-customization-info

    Gather info about VM customization specifications

  • vmware-guest-disk

    Manage disks related to virtual machine in given vCenter infrastructure

  • vmware-guest-disk-info

    Gather info about disks of given virtual machine

  • vmware-guest-find

    Find the folder path(s) for a virtual machine by name or UUID

  • vmware-guest-info

    Gather info about a single VM

  • vmware-guest-move

    Moves virtual machines in vCenter

  • vmware-guest-network

    Manage network adapters of specified virtual machine in given vCenter infrastructure

  • vmware-guest-powerstate

    Manages power states of virtual machines in vCenter

  • vmware-guest-screenshot

    Create a screenshot of the Virtual Machine console.

  • vmware-guest-sendkey

    Send USB HID codes to the Virtual Machine's keyboard.

  • vmware-guest-snapshot

    Manages virtual machines snapshots in vCenter

  • vmware-guest-snapshot-info

    Gather info about virtual machine's snapshots in vCenter

  • vmware-guest-tools-upgrade

    Module to upgrade VMTools

  • vmware-guest-tools-wait

    Wait for VMware tools to become available

  • vmware-guest-video

    Modify video card configurations of specified virtual machine in given vCenter infrastructure

  • vmware-guest-vnc

    Manages VNC remote display on virtual machines in vCenter

  • vmware-host

    Add, remove, or move an ESXi host to, from, or within vCenter

  • vmware-host-acceptance

    Manage the host acceptance level of an ESXi host

  • vmware-host-active-directory

    Joins an ESXi host system to an Active Directory domain or leaves it

  • vmware-host-capability-info

    Gathers info about an ESXi host's capability information

  • vmware-host-config-info

    Gathers info about an ESXi host's advance configuration information

  • vmware-host-config-manager

    Manage advanced system settings of an ESXi host

  • vmware-host-datastore

    Manage a datastore on ESXi host

  • vmware-host-dns-info

    Gathers info about an ESXi host's DNS configuration information

  • vmware-host-facts

    Gathers facts about remote ESXi hostsystem

  • vmware-host-feature-info

    Gathers info about an ESXi host's feature capability information

  • vmware-host-firewall-info

    Gathers info about an ESXi host's firewall configuration information

  • vmware-host-firewall-manager

    Manage firewall configurations about an ESXi host

  • vmware-host-hyperthreading

    Enables/Disables Hyperthreading optimization for an ESXi host system

  • vmware-host-ipv6

    Enables/Disables IPv6 support for an ESXi host system

  • vmware-host-kernel-manager

    Manage kernel module options on ESXi hosts

  • vmware-host-lockdown

    Manage administrator permission for the local administrative account for the ESXi host

  • vmware-host-ntp

    Manage NTP server configuration of an ESXi host

  • vmware-host-ntp-info

    Gathers info about NTP configuration on an ESXi host

  • vmware-host-package-info

    Gathers info about available packages on an ESXi host

  • vmware-host-powermgmt-policy

    Manages the Power Management Policy of an ESXI host system

  • vmware-host-powerstate

    Manages power states of host systems in vCenter

  • vmware-host-scanhba

    Rescan host HBA's and optionally refresh the storage system

  • vmware-host-service-info

    Gathers info about an ESXi host's services

  • vmware-host-service-manager

    Manage services on a given ESXi host

  • vmware-host-snmp

    Configures SNMP on an ESXi host system

  • vmware-host-ssl-info

    Gather info of ESXi host system about SSL

  • vmware-host-vmhba-info

    Gathers info about vmhbas available on the given ESXi host

  • vmware-host-vmnic-info

    Gathers info about vmnics available on the given ESXi host

  • vmware-local-role-info

    Gather info about local roles on an ESXi host

  • vmware-local-role-manager

    Manage local roles on an ESXi host

  • vmware-local-user-info

    Gather info about users on the given ESXi host

  • vmware-local-user-manager

    Manage local users on an ESXi host

  • vmware-maintenancemode

    Place a host into maintenance mode

  • vmware-migrate-vmk

    Migrate a VMK interface from VSS to VDS

  • vmware-object-role-permission

    Manage local roles on an ESXi host

  • vmware-portgroup

    Create a VMware portgroup

  • vmware-portgroup-info

    Gathers info about an ESXi host's Port Group configuration

  • vmware-resource-pool

    Add/remove resource pools to/from vCenter

  • vmware-resource-pool-info

    Gathers info about resource pool information

  • vmware-tag

    Manage VMware tags

  • vmware-tag-info

    Manage VMware tag info

  • vmware-tag-manager

    Manage association of VMware tags with VMware objects

  • vmware-target-canonical-info

    Return canonical (NAA) from an ESXi host system

  • vmware-vcenter-extension

    Register/deregister vCenter Extensions

  • vmware-vcenter-extension-info

    Gather info vCenter extensions

  • vmware-vcenter-folder

    Manage folders on given datacenter

  • vmware-vcenter-license

    Manage VMware vCenter license keys

  • vmware-vcenter-settings

    Configures general settings on a vCenter server

  • vmware-vcenter-statistics

    Configures statistics on a vCenter server

  • vmware-vm-host-drs-rule

    Creates vm/host group in a given cluster

  • vmware-vm-info

    Return basic info pertaining to a VMware machine guest

  • vmware-vm-shell

    Run commands in a VMware guest operating system

  • vmware-vm-storage-policy-info

    Gather information about vSphere storage profile defined storage policy information.

  • vmware-vm-vm-drs-rule

    Configure VMware DRS Affinity rule for virtual machine in given cluster

  • vmware-vm-vss-dvs-migrate

    Migrates a virtual machine from a standard vswitch to distributed

  • vmware-vmkernel

    Manages a VMware VMkernel Adapter of an ESXi host.

  • vmware-vmkernel-info

    Gathers VMKernel info about an ESXi host

  • vmware-vmkernel-ip-config

    Configure the VMkernel IP Address

  • vmware-vmotion

    Move a virtual machine using vMotion, and/or its vmdks using storage vMotion.

  • vmware-vsan-cluster

    Configure VSAN clustering on an ESXi host

  • vmware-vspan-session

    Create or remove a Port Mirroring session.

  • vmware-vsphere-file

    Manage files on a vCenter datastore

  • vmware-vswitch

    Manage a VMware Standard Switch to an ESXi host.

  • vmware-vswitch-info

    Gathers info about an ESXi host's vswitch configurations

import demistomock as demisto  # noqa: F401
from CommonServerPython import *  # noqa: F401
import json
import traceback
from typing import Dict, cast

import ansible_runner
import ssh_agent_setup


# Dict to Markdown Converter adapted from https://github.com/PolBaladas/torsimany/
def dict2md(json_block, depth=0):
    markdown = ""
    if isinstance(json_block, dict):
        markdown = parseDict(json_block, depth)
    if isinstance(json_block, list):
        markdown = parseList(json_block, depth)
    return markdown


def parseDict(d, depth):
    markdown = ""
    for k in d:
        if isinstance(d[k], (dict, list)):
            markdown += addHeader(k, depth)
            markdown += dict2md(d[k], depth + 1)
        else:
            markdown += buildValueChain(k, d[k], depth)
    return markdown


def parseList(rawlist, depth):
    markdown = ""
    for value in rawlist:
        if not isinstance(value, (dict, list)):
            index = rawlist.index(value)
            markdown += buildValueChain(index, value, depth)
        else:
            markdown += parseDict(value, depth)
    return markdown


def buildHeaderChain(depth):
    list_tag = '* '
    htag = '#'

    chain = list_tag * (bool(depth)) + htag * (depth + 1) + \
        ' value ' + (htag * (depth + 1) + '\n')
    return chain


def buildValueChain(key, value, depth):
    tab = "  "
    list_tag = '* '

    chain = tab * (bool(depth - 1)) + list_tag + \
        str(key) + ": " + str(value) + "\n"
    return chain


def addHeader(value, depth):
    chain = buildHeaderChain(depth)
    chain = chain.replace('value', value.title())
    return chain


# Remove ansible branding from results
def rec_ansible_key_strip(obj):
    if isinstance(obj, dict):
        return {key.replace('ansible_', ''): rec_ansible_key_strip(val) for key, val in obj.items()}
    return obj


# COMMAND FUNCTIONS


def generic_ansible(integration_name, command, args: Dict[str, Any]) -> CommandResults:

    readable_output = ""
    sshkey = ""
    fork_count = 1   # default to executing against 1 host at a time

    if args.get('concurrency'):
        fork_count = cast(int, args.get('concurrency'))

    inventory: Dict[str, dict] = {}
    inventory['all'] = {}
    inventory['all']['hosts'] = {}

    inventory['all']['hosts']['localhost'] = {}
    inventory['all']['hosts']['localhost']['ansible_connection'] = 'local'

    module_args = ""
    # build module args list
    for arg_key, arg_value in args.items():
        # skip hardcoded host arg, as it doesn't related to module
        if arg_key == 'host':
            continue

        module_args += "%s=\"%s\" " % (arg_key, arg_value)
    # If this isn't host based, then all the integratation parms will be used as command args
    for arg_key, arg_value in demisto.params().items():
        module_args += "%s=\"%s\" " % (arg_key, arg_value)

    r = ansible_runner.run(inventory=inventory, host_pattern='all', module=command, quiet=True,
                           omit_event_data=True, ssh_key=sshkey, module_args=module_args, forks=fork_count)

    results = []
    for each_host_event in r.events:
        # Troubleshooting
        # demisto.log("%s: %s\n" % (each_host_event['event'], each_host_event))
        if each_host_event['event'] in ["runner_on_ok", "runner_on_unreachable", "runner_on_failed"]:

            # parse results

            result = json.loads('{' + each_host_event['stdout'].split('{', 1)[1])
            host = each_host_event['stdout'].split('|', 1)[0].strip()
            status = each_host_event['stdout'].replace('=>', '|').split('|', 3)[1]

            # if successful build outputs
            if each_host_event['event'] == "runner_on_ok":
                if 'fact' in command:
                    result = result['ansible_facts']
                else:
                    if result.get(command) is not None:
                        result = result[command]
                    else:
                        result.pop("ansible_facts", None)

                result = rec_ansible_key_strip(result)

                if host != "localhost":
                    readable_output += "# %s - %s\n" % (host, status)
                else:
                    # This is integration is not host based
                    readable_output += "# %s\n" % status

                readable_output += dict2md(result)

                # add host and status to result
                result['host'] = host
                result['status'] = status

                results.append(result)
            if each_host_event['event'] == "runner_on_unreachable":
                msg = "Host %s unreachable\nError Details: %s" % (host, result)
                return_error(msg)

            if each_host_event['event'] == "runner_on_failed":
                msg = "Host %s failed running command\nError Details: %s" % (host, result)
                return_error(msg)
    # This is integration is not host based and always runs against localhost
    results = results[0]

    return CommandResults(
        readable_output=readable_output,
        outputs_prefix=integration_name + '.' + command,
        outputs_key_field='',
        outputs=results
    )


# MAIN FUNCTION


def main() -> None:
    """main function, parses params and runs command functions

    :return:
    :rtype:
    """

    # SSH Key integration requires ssh_agent to be running in the background
    ssh_agent_setup.setup()

    try:

        if demisto.command() == 'test-module':
            # This is the call made when pressing the integration Test button.
            return_results('ok')
        elif demisto.command() == 'vmware-about-info':
            return_results(generic_ansible('vmwarev2', 'vmware_about_info', demisto.args()))
        elif demisto.command() == 'vmware-category':
            return_results(generic_ansible('vmwarev2', 'vmware_category', demisto.args()))
        elif demisto.command() == 'vmware-category-info':
            return_results(generic_ansible('vmwarev2', 'vmware_category_info', demisto.args()))
        elif demisto.command() == 'vmware-cfg-backup':
            return_results(generic_ansible('vmwarev2', 'vmware_cfg_backup', demisto.args()))
        elif demisto.command() == 'vmware-cluster':
            return_results(generic_ansible('vmwarev2', 'vmware_cluster', demisto.args()))
        elif demisto.command() == 'vmware-cluster-drs':
            return_results(generic_ansible('vmwarev2', 'vmware_cluster_drs', demisto.args()))
        elif demisto.command() == 'vmware-cluster-ha':
            return_results(generic_ansible('vmwarev2', 'vmware_cluster_ha', demisto.args()))
        elif demisto.command() == 'vmware-cluster-info':
            return_results(generic_ansible('vmwarev2', 'vmware_cluster_info', demisto.args()))
        elif demisto.command() == 'vmware-cluster-vsan':
            return_results(generic_ansible('vmwarev2', 'vmware_cluster_vsan', demisto.args()))
        elif demisto.command() == 'vmware-content-deploy-template':
            return_results(generic_ansible('vmwarev2', 'vmware_content_deploy_template', demisto.args()))
        elif demisto.command() == 'vmware-content-library-info':
            return_results(generic_ansible('vmwarev2', 'vmware_content_library_info', demisto.args()))
        elif demisto.command() == 'vmware-content-library-manager':
            return_results(generic_ansible('vmwarev2', 'vmware_content_library_manager', demisto.args()))
        elif demisto.command() == 'vmware-datacenter':
            return_results(generic_ansible('vmwarev2', 'vmware_datacenter', demisto.args()))
        elif demisto.command() == 'vmware-datastore-cluster':
            return_results(generic_ansible('vmwarev2', 'vmware_datastore_cluster', demisto.args()))
        elif demisto.command() == 'vmware-datastore-info':
            return_results(generic_ansible('vmwarev2', 'vmware_datastore_info', demisto.args()))
        elif demisto.command() == 'vmware-datastore-maintenancemode':
            return_results(generic_ansible('vmwarev2', 'vmware_datastore_maintenancemode', demisto.args()))
        elif demisto.command() == 'vmware-dns-config':
            return_results(generic_ansible('vmwarev2', 'vmware_dns_config', demisto.args()))
        elif demisto.command() == 'vmware-drs-group':
            return_results(generic_ansible('vmwarev2', 'vmware_drs_group', demisto.args()))
        elif demisto.command() == 'vmware-drs-group-info':
            return_results(generic_ansible('vmwarev2', 'vmware_drs_group_info', demisto.args()))
        elif demisto.command() == 'vmware-drs-rule-info':
            return_results(generic_ansible('vmwarev2', 'vmware_drs_rule_info', demisto.args()))
        elif demisto.command() == 'vmware-dvs-host':
            return_results(generic_ansible('vmwarev2', 'vmware_dvs_host', demisto.args()))
        elif demisto.command() == 'vmware-dvs-portgroup':
            return_results(generic_ansible('vmwarev2', 'vmware_dvs_portgroup', demisto.args()))
        elif demisto.command() == 'vmware-dvs-portgroup-find':
            return_results(generic_ansible('vmwarev2', 'vmware_dvs_portgroup_find', demisto.args()))
        elif demisto.command() == 'vmware-dvs-portgroup-info':
            return_results(generic_ansible('vmwarev2', 'vmware_dvs_portgroup_info', demisto.args()))
        elif demisto.command() == 'vmware-dvswitch':
            return_results(generic_ansible('vmwarev2', 'vmware_dvswitch', demisto.args()))
        elif demisto.command() == 'vmware-dvswitch-lacp':
            return_results(generic_ansible('vmwarev2', 'vmware_dvswitch_lacp', demisto.args()))
        elif demisto.command() == 'vmware-dvswitch-nioc':
            return_results(generic_ansible('vmwarev2', 'vmware_dvswitch_nioc', demisto.args()))
        elif demisto.command() == 'vmware-dvswitch-pvlans':
            return_results(generic_ansible('vmwarev2', 'vmware_dvswitch_pvlans', demisto.args()))
        elif demisto.command() == 'vmware-dvswitch-uplink-pg':
            return_results(generic_ansible('vmwarev2', 'vmware_dvswitch_uplink_pg', demisto.args()))
        elif demisto.command() == 'vmware-evc-mode':
            return_results(generic_ansible('vmwarev2', 'vmware_evc_mode', demisto.args()))
        elif demisto.command() == 'vmware-folder-info':
            return_results(generic_ansible('vmwarev2', 'vmware_folder_info', demisto.args()))
        elif demisto.command() == 'vmware-guest':
            return_results(generic_ansible('vmwarev2', 'vmware_guest', demisto.args()))
        elif demisto.command() == 'vmware-guest-boot-info':
            return_results(generic_ansible('vmwarev2', 'vmware_guest_boot_info', demisto.args()))
        elif demisto.command() == 'vmware-guest-boot-manager':
            return_results(generic_ansible('vmwarev2', 'vmware_guest_boot_manager', demisto.args()))
        elif demisto.command() == 'vmware-guest-custom-attribute-defs':
            return_results(generic_ansible('vmwarev2', 'vmware_guest_custom_attribute_defs', demisto.args()))
        elif demisto.command() == 'vmware-guest-custom-attributes':
            return_results(generic_ansible('vmwarev2', 'vmware_guest_custom_attributes', demisto.args()))
        elif demisto.command() == 'vmware-guest-customization-info':
            return_results(generic_ansible('vmwarev2', 'vmware_guest_customization_info', demisto.args()))
        elif demisto.command() == 'vmware-guest-disk':
            return_results(generic_ansible('vmwarev2', 'vmware_guest_disk', demisto.args()))
        elif demisto.command() == 'vmware-guest-disk-info':
            return_results(generic_ansible('vmwarev2', 'vmware_guest_disk_info', demisto.args()))
        elif demisto.command() == 'vmware-guest-find':
            return_results(generic_ansible('vmwarev2', 'vmware_guest_find', demisto.args()))
        elif demisto.command() == 'vmware-guest-info':
            return_results(generic_ansible('vmwarev2', 'vmware_guest_info', demisto.args()))
        elif demisto.command() == 'vmware-guest-move':
            return_results(generic_ansible('vmwarev2', 'vmware_guest_move', demisto.args()))
        elif demisto.command() == 'vmware-guest-network':
            return_results(generic_ansible('vmwarev2', 'vmware_guest_network', demisto.args()))
        elif demisto.command() == 'vmware-guest-powerstate':
            return_results(generic_ansible('vmwarev2', 'vmware_guest_powerstate', demisto.args()))
        elif demisto.command() == 'vmware-guest-screenshot':
            return_results(generic_ansible('vmwarev2', 'vmware_guest_screenshot', demisto.args()))
        elif demisto.command() == 'vmware-guest-sendkey':
            return_results(generic_ansible('vmwarev2', 'vmware_guest_sendkey', demisto.args()))
        elif demisto.command() == 'vmware-guest-snapshot':
            return_results(generic_ansible('vmwarev2', 'vmware_guest_snapshot', demisto.args()))
        elif demisto.command() == 'vmware-guest-snapshot-info':
            return_results(generic_ansible('vmwarev2', 'vmware_guest_snapshot_info', demisto.args()))
        elif demisto.command() == 'vmware-guest-tools-upgrade':
            return_results(generic_ansible('vmwarev2', 'vmware_guest_tools_upgrade', demisto.args()))
        elif demisto.command() == 'vmware-guest-tools-wait':
            return_results(generic_ansible('vmwarev2', 'vmware_guest_tools_wait', demisto.args()))
        elif demisto.command() == 'vmware-guest-video':
            return_results(generic_ansible('vmwarev2', 'vmware_guest_video', demisto.args()))
        elif demisto.command() == 'vmware-guest-vnc':
            return_results(generic_ansible('vmwarev2', 'vmware_guest_vnc', demisto.args()))
        elif demisto.command() == 'vmware-host':
            return_results(generic_ansible('vmwarev2', 'vmware_host', demisto.args()))
        elif demisto.command() == 'vmware-host-acceptance':
            return_results(generic_ansible('vmwarev2', 'vmware_host_acceptance', demisto.args()))
        elif demisto.command() == 'vmware-host-active-directory':
            return_results(generic_ansible('vmwarev2', 'vmware_host_active_directory', demisto.args()))
        elif demisto.command() == 'vmware-host-capability-info':
            return_results(generic_ansible('vmwarev2', 'vmware_host_capability_info', demisto.args()))
        elif demisto.command() == 'vmware-host-config-info':
            return_results(generic_ansible('vmwarev2', 'vmware_host_config_info', demisto.args()))
        elif demisto.command() == 'vmware-host-config-manager':
            return_results(generic_ansible('vmwarev2', 'vmware_host_config_manager', demisto.args()))
        elif demisto.command() == 'vmware-host-datastore':
            return_results(generic_ansible('vmwarev2', 'vmware_host_datastore', demisto.args()))
        elif demisto.command() == 'vmware-host-dns-info':
            return_results(generic_ansible('vmwarev2', 'vmware_host_dns_info', demisto.args()))
        elif demisto.command() == 'vmware-host-facts':
            return_results(generic_ansible('vmwarev2', 'vmware_host_facts', demisto.args()))
        elif demisto.command() == 'vmware-host-feature-info':
            return_results(generic_ansible('vmwarev2', 'vmware_host_feature_info', demisto.args()))
        elif demisto.command() == 'vmware-host-firewall-info':
            return_results(generic_ansible('vmwarev2', 'vmware_host_firewall_info', demisto.args()))
        elif demisto.command() == 'vmware-host-firewall-manager':
            return_results(generic_ansible('vmwarev2', 'vmware_host_firewall_manager', demisto.args()))
        elif demisto.command() == 'vmware-host-hyperthreading':
            return_results(generic_ansible('vmwarev2', 'vmware_host_hyperthreading', demisto.args()))
        elif demisto.command() == 'vmware-host-ipv6':
            return_results(generic_ansible('vmwarev2', 'vmware_host_ipv6', demisto.args()))
        elif demisto.command() == 'vmware-host-kernel-manager':
            return_results(generic_ansible('vmwarev2', 'vmware_host_kernel_manager', demisto.args()))
        elif demisto.command() == 'vmware-host-lockdown':
            return_results(generic_ansible('vmwarev2', 'vmware_host_lockdown', demisto.args()))
        elif demisto.command() == 'vmware-host-ntp':
            return_results(generic_ansible('vmwarev2', 'vmware_host_ntp', demisto.args()))
        elif demisto.command() == 'vmware-host-ntp-info':
            return_results(generic_ansible('vmwarev2', 'vmware_host_ntp_info', demisto.args()))
        elif demisto.command() == 'vmware-host-package-info':
            return_results(generic_ansible('vmwarev2', 'vmware_host_package_info', demisto.args()))
        elif demisto.command() == 'vmware-host-powermgmt-policy':
            return_results(generic_ansible('vmwarev2', 'vmware_host_powermgmt_policy', demisto.args()))
        elif demisto.command() == 'vmware-host-powerstate':
            return_results(generic_ansible('vmwarev2', 'vmware_host_powerstate', demisto.args()))
        elif demisto.command() == 'vmware-host-scanhba':
            return_results(generic_ansible('vmwarev2', 'vmware_host_scanhba', demisto.args()))
        elif demisto.command() == 'vmware-host-service-info':
            return_results(generic_ansible('vmwarev2', 'vmware_host_service_info', demisto.args()))
        elif demisto.command() == 'vmware-host-service-manager':
            return_results(generic_ansible('vmwarev2', 'vmware_host_service_manager', demisto.args()))
        elif demisto.command() == 'vmware-host-snmp':
            return_results(generic_ansible('vmwarev2', 'vmware_host_snmp', demisto.args()))
        elif demisto.command() == 'vmware-host-ssl-info':
            return_results(generic_ansible('vmwarev2', 'vmware_host_ssl_info', demisto.args()))
        elif demisto.command() == 'vmware-host-vmhba-info':
            return_results(generic_ansible('vmwarev2', 'vmware_host_vmhba_info', demisto.args()))
        elif demisto.command() == 'vmware-host-vmnic-info':
            return_results(generic_ansible('vmwarev2', 'vmware_host_vmnic_info', demisto.args()))
        elif demisto.command() == 'vmware-local-role-info':
            return_results(generic_ansible('vmwarev2', 'vmware_local_role_info', demisto.args()))
        elif demisto.command() == 'vmware-local-role-manager':
            return_results(generic_ansible('vmwarev2', 'vmware_local_role_manager', demisto.args()))
        elif demisto.command() == 'vmware-local-user-info':
            return_results(generic_ansible('vmwarev2', 'vmware_local_user_info', demisto.args()))
        elif demisto.command() == 'vmware-local-user-manager':
            return_results(generic_ansible('vmwarev2', 'vmware_local_user_manager', demisto.args()))
        elif demisto.command() == 'vmware-maintenancemode':
            return_results(generic_ansible('vmwarev2', 'vmware_maintenancemode', demisto.args()))
        elif demisto.command() == 'vmware-migrate-vmk':
            return_results(generic_ansible('vmwarev2', 'vmware_migrate_vmk', demisto.args()))
        elif demisto.command() == 'vmware-object-role-permission':
            return_results(generic_ansible('vmwarev2', 'vmware_object_role_permission', demisto.args()))
        elif demisto.command() == 'vmware-portgroup':
            return_results(generic_ansible('vmwarev2', 'vmware_portgroup', demisto.args()))
        elif demisto.command() == 'vmware-portgroup-info':
            return_results(generic_ansible('vmwarev2', 'vmware_portgroup_info', demisto.args()))
        elif demisto.command() == 'vmware-resource-pool':
            return_results(generic_ansible('vmwarev2', 'vmware_resource_pool', demisto.args()))
        elif demisto.command() == 'vmware-resource-pool-info':
            return_results(generic_ansible('vmwarev2', 'vmware_resource_pool_info', demisto.args()))
        elif demisto.command() == 'vmware-tag':
            return_results(generic_ansible('vmwarev2', 'vmware_tag', demisto.args()))
        elif demisto.command() == 'vmware-tag-info':
            return_results(generic_ansible('vmwarev2', 'vmware_tag_info', demisto.args()))
        elif demisto.command() == 'vmware-tag-manager':
            return_results(generic_ansible('vmwarev2', 'vmware_tag_manager', demisto.args()))
        elif demisto.command() == 'vmware-target-canonical-info':
            return_results(generic_ansible('vmwarev2', 'vmware_target_canonical_info', demisto.args()))
        elif demisto.command() == 'vmware-vcenter-settings':
            return_results(generic_ansible('vmwarev2', 'vmware_vcenter_settings', demisto.args()))
        elif demisto.command() == 'vmware-vcenter-statistics':
            return_results(generic_ansible('vmwarev2', 'vmware_vcenter_statistics', demisto.args()))
        elif demisto.command() == 'vmware-vm-host-drs-rule':
            return_results(generic_ansible('vmwarev2', 'vmware_vm_host_drs_rule', demisto.args()))
        elif demisto.command() == 'vmware-vm-info':
            return_results(generic_ansible('vmwarev2', 'vmware_vm_info', demisto.args()))
        elif demisto.command() == 'vmware-vm-shell':
            return_results(generic_ansible('vmwarev2', 'vmware_vm_shell', demisto.args()))
        elif demisto.command() == 'vmware-vm-storage-policy-info':
            return_results(generic_ansible('vmwarev2', 'vmware_vm_storage_policy_info', demisto.args()))
        elif demisto.command() == 'vmware-vm-vm-drs-rule':
            return_results(generic_ansible('vmwarev2', 'vmware_vm_vm_drs_rule', demisto.args()))
        elif demisto.command() == 'vmware-vm-vss-dvs-migrate':
            return_results(generic_ansible('vmwarev2', 'vmware_vm_vss_dvs_migrate', demisto.args()))
        elif demisto.command() == 'vmware-vmkernel':
            return_results(generic_ansible('vmwarev2', 'vmware_vmkernel', demisto.args()))
        elif demisto.command() == 'vmware-vmkernel-info':
            return_results(generic_ansible('vmwarev2', 'vmware_vmkernel_info', demisto.args()))
        elif demisto.command() == 'vmware-vmkernel-ip-config':
            return_results(generic_ansible('vmwarev2', 'vmware_vmkernel_ip_config', demisto.args()))
        elif demisto.command() == 'vmware-vmotion':
            return_results(generic_ansible('vmwarev2', 'vmware_vmotion', demisto.args()))
        elif demisto.command() == 'vmware-vsan-cluster':
            return_results(generic_ansible('vmwarev2', 'vmware_vsan_cluster', demisto.args()))
        elif demisto.command() == 'vmware-vspan-session':
            return_results(generic_ansible('vmwarev2', 'vmware_vspan_session', demisto.args()))
        elif demisto.command() == 'vmware-vswitch':
            return_results(generic_ansible('vmwarev2', 'vmware_vswitch', demisto.args()))
        elif demisto.command() == 'vmware-vswitch-info':
            return_results(generic_ansible('vmwarev2', 'vmware_vswitch_info', demisto.args()))
        elif demisto.command() == 'vmware-vsphere-file':
            return_results(generic_ansible('vmwarev2', 'vsphere_file', demisto.args()))
        elif demisto.command() == 'vmware-vcenter-extension':
            return_results(generic_ansible('vmwarev2', 'vcenter_extension', demisto.args()))
        elif demisto.command() == 'vmware-vcenter-extension-info':
            return_results(generic_ansible('vmwarev2', 'vcenter_extension_info', demisto.args()))
        elif demisto.command() == 'vmware-vcenter-folder':
            return_results(generic_ansible('vmwarev2', 'vcenter_folder', demisto.args()))
        elif demisto.command() == 'vmware-vcenter-license':
            return_results(generic_ansible('vmwarev2', 'vcenter_license', demisto.args()))
    # Log exceptions and return errors
    except Exception as e:
        demisto.error(traceback.format_exc())  # print the traceback
        return_error(f'Failed to execute {demisto.command()} command.\nError:\n{str(e)}')


# ENTRY POINT


if __name__ in ('__main__', '__builtin__', 'builtins'):
    main()