# salt.states.esxcluster

Manage VMware ESXi Clusters.

## Dependencies

- pyVmomi Python Module

### pyVmomi

PyVmomi can be installed via pip:

    pip install pyVmomi

Note

Version 6.0 of pyVmomi has some problems with SSL error handling on certain versions of Python. If using version 6.0 of pyVmomi, Python 2.7.9, or newer must be present. This is due to an upstream dependency in pyVmomi 6.0 that is not supported in Python versions 2.7 to 2.7.8. If the version of Python is not in the supported range, you will need to install an earlier version of pyVmomi. See Issue #29537 for more information.

Based on the note above, to install an earlier version of pyVmomi than the version currently listed in PyPi, run the following:

    pip install pyVmomi==5.5.0.2014.1.1

The 5.5.0.2014.1.1 is a known stable version that this original ESXi State Module was developed against.

salt.states.esxcluster.cluster_configured(name, cluster_config)

  Configures a cluster. Creates a new cluster, if it doesn't exist on the vCenter or reconfigures it if configured differently

  Supported proxies: esxdatacenter, esxcluster

  name

    Name of the state. If the state is run in by an `esxdatacenter` proxy, it will be the name of the cluster.

  cluster_config

    Configuration applied to the cluster. Complex datastructure following the ESXClusterConfigSchema. Valid example is:

      drs:
          default_vm_behavior: fullyAutomated
          enabled: true
          vmotion_rate: 3
      ha:
          admission_control
          _enabled: false
          default_vm_settings:
              isolation_response: powerOff
              restart_priority: medium
          enabled: true
          hb_ds_candidate_policy: userSelectedDs
          host_monitoring: enabled
          options:
              - key: das.ignoreinsufficienthbdatastore
                value: 'true'
          vm_monitoring: vmMonitoringDisabled
      vm_swap_placement: vmDirectory
      vsan:
          auto_claim_storage: false
          compression_enabled: true
          dedup_enabled: true
          enabled: true

salt.states.esxcluster.licenses_configured(name, licenses=None)

  Configures licenses on the cluster entity

  Checks if each license exists on the server:

    - if it doesn't, it creates it

  Check if license is assigned to the cluster:
    - if it's not assigned to the cluster:

        - assign it to the cluster if there is space

        - error if there's no space

    - if it's assigned to the cluster nothing needs to be done

salt.states.esxcluster.vsan_datastore_configured(name, datastore_name)

  Configures the cluster's VSAN datastore

  WARNING: The VSAN datastore is created automatically after the first ESXi host is added to the cluster; the state assumes that the datastore exists and errors if it doesn't.