community.vmware.vmware_datastore_cluster (0.4.0) — module

Manage VMware vSphere datastore clusters

Authors: Abhijeet Kasurde (@Akasurde)

preview | supported by community

Install collection

Install with ansible-galaxy collection install community.vmware:==0.4.0


Add to requirements.yml

  collections:
    - name: community.vmware
      version: 0.4.0

Description

This module can be used to add and delete datastore cluster in given VMware environment.

All parameters and VMware object values are case sensitive.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create datastore cluster and enable SDRS
  vmware_datastore_cluster:
    hostname: '{{ vcenter_hostname }}'
    username: '{{ vcenter_username }}'
    password: '{{ vcenter_password }}'
    datacenter_name: '{{ datacenter_name }}'
    datastore_cluster_name: '{{ datastore_cluster_name }}'
    enable_sdrs: True
    state: present
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create datastore cluster using folder
  vmware_datastore_cluster:
    hostname: '{{ vcenter_hostname }}'
    username: '{{ vcenter_username }}'
    password: '{{ vcenter_password }}'
    folder: '/{{ datacenter_name }}/datastore/ds_folder'
    datastore_cluster_name: '{{ datastore_cluster_name }}'
    state: present
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete datastore cluster
  vmware_datastore_cluster:
    hostname: '{{ vcenter_hostname }}'
    username: '{{ vcenter_username }}'
    password: '{{ vcenter_password }}'
    datacenter_name: '{{ datacenter_name }}'
    datastore_cluster_name: '{{ datastore_cluster_name }}'
    state: absent
  delegate_to: localhost

Inputs

    
port:
    default: 443
    description:
    - The port number of the vSphere vCenter or ESXi server.
    - If the value is not specified in the task, the value of environment variable C(VMWARE_PORT)
      will be used instead.
    - Environment variable support added in Ansible 2.6.
    type: int

state:
    choices:
    - present
    - absent
    default: present
    description:
    - If the datastore cluster should be present or absent.
    type: str

folder:
    description:
    - Destination folder, absolute path to place datastore cluster in.
    - The folder should include the datacenter.
    - This parameter is case sensitive.
    - You must specify either a C(folder) or a C(datacenter_name).
    - 'Examples:'
    - '   folder: /datacenter1/datastore'
    - '   folder: datacenter1/datastore'
    - '   folder: /datacenter1/datastore/folder1'
    - '   folder: datacenter1/datastore/folder1'
    - '   folder: /folder1/datacenter1/datastore'
    - '   folder: folder1/datacenter1/datastore'
    - '   folder: /folder1/datacenter1/datastore/folder2'
    required: false
    type: str

hostname:
    description:
    - The hostname or IP address of the vSphere vCenter or ESXi server.
    - If the value is not specified in the task, the value of environment variable C(VMWARE_HOST)
      will be used instead.
    - Environment variable support added in Ansible 2.6.
    type: str

password:
    aliases:
    - pass
    - pwd
    description:
    - The password of the vSphere vCenter or ESXi server.
    - If the value is not specified in the task, the value of environment variable C(VMWARE_PASSWORD)
      will be used instead.
    - Environment variable support added in Ansible 2.6.
    type: str

username:
    aliases:
    - admin
    - user
    description:
    - The username of the vSphere vCenter or ESXi server.
    - If the value is not specified in the task, the value of environment variable C(VMWARE_USER)
      will be used instead.
    - Environment variable support added in Ansible 2.6.
    type: str

proxy_host:
    description:
    - Address of a proxy that will receive all HTTPS requests and relay them.
    - The format is a hostname or a IP.
    - If the value is not specified in the task, the value of environment variable C(VMWARE_PROXY_HOST)
      will be used instead.
    - This feature depends on a version of pyvmomi greater than v6.7.1.2018.12
    required: false
    type: str

proxy_port:
    description:
    - Port of the HTTP proxy that will receive all HTTPS requests and relay them.
    - If the value is not specified in the task, the value of environment variable C(VMWARE_PROXY_PORT)
      will be used instead.
    required: false
    type: int

enable_sdrs:
    default: false
    description:
    - Whether or not storage DRS is enabled.
    required: false
    type: bool

validate_certs:
    default: true
    description:
    - Allows connection when SSL certificates are not valid. Set to C(false) when certificates
      are not trusted.
    - If the value is not specified in the task, the value of environment variable C(VMWARE_VALIDATE_CERTS)
      will be used instead.
    - Environment variable support added in Ansible 2.6.
    - If set to C(yes), please make sure Python >= 2.7.9 is installed on the given machine.
    type: bool

datacenter_name:
    aliases:
    - datacenter
    description:
    - The name of the datacenter.
    - You must specify either a C(datacenter_name) or a C(folder).
    - Mutually exclusive with C(folder) parameter.
    required: false
    type: str

automation_level:
    choices:
    - automated
    - manual
    default: manual
    description:
    - Run SDRS automated or manually.
    required: false
    type: str

keep_vmdks_together:
    default: true
    description:
    - Specifies whether or not each VM in this datastore cluster should have its virtual
      disks on the same datastore by default.
    required: false
    type: bool

loadbalance_interval:
    default: 480
    description:
    - Specify the interval in minutes that storage DRS runs to load balance among datastores.
    required: false
    type: int

enable_io_loadbalance:
    default: false
    description:
    - Whether or not storage DRS takes into account storage I/O workload when making load
      balancing and initial placement recommendations.
    required: false
    type: bool

datastore_cluster_name:
    description:
    - The name of the datastore cluster.
    required: true
    type: str

Outputs

result:
  description: information about datastore cluster operation
  returned: always
  sample: Datastore cluster 'DSC2' created successfully.
  type: str