cohesity.dataprotect.cohesity_restore_vm (1.1.9) — module

Restore one or more Virtual Machines from Cohesity Protection Jobs

| "added in version" 1.1.9 of cohesity.dataprotect"

Authors: Naveena (@naveena-maplelabs)

Install collection

Install with ansible-galaxy collection install cohesity.dataprotect:==1.1.9


Add to requirements.yml

  collections:
    - name: cohesity.dataprotect
      version: 1.1.9

Description

Ansible Module used to start a Cohesity Recovery Job on a Cohesity Cluster.

When executed in a playbook, the Cohesity Recovery Job will be validated and the appropriate state action

will be applied.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.

# Restore a single Virtual Machine
- name: Restore a Virtual Machine
  cohesity_restore_vm:
    cluster: cohesity.lab
    username: admin
    password: password
    state: present
    name: "Ansible Test VM Restore"
    endpoint: "myvcenter.cohesity.demo"
    environment: "VMware"
    job_name: "myvcenter.cohesity.demo"
    vm_names:
      - chs-win-01
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Restore multiple Virtual Machines from a specific snapshot with a new prefix and disable the network
- name: Restore a Virtual Machine
  cohesity_restore_vm:
    cluster: cohesity.lab
    username: admin
    password: password
    state: present
    name: "Ansible Test VM Restore"
    endpoint: "myvcenter.cohesity.demo"
    environment: "VMware"
    job_name: "myvcenter.cohesity.demo"
    backup_id: "48291"
    vm_names:
      - chs-win-01
      - chs-win-02
    prefix: "rst-"
    network_connected: no

Inputs

    
name:
    description:
    - Descriptor to assign to the Recovery Job.  The Recovery Job name will consist of
      the job_name:name format.
    required: true
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Determines the state of the Recovery Job.
    - (C)present a recovery job will be created and started.
    - (C)absent is currently not implemented
    type: str

prefix:
    description:
    - Specifies a prefix to prepended to the source object name to derive a new name for
      the recovered or cloned object.
    type: str

suffix:
    description:
    - Specifies a suffix to appended to the original source object name to derive a new
      name for the recovered or cloned object
    type: str

cluster:
    aliases:
    - cohesity_server
    description:
    - IP or FQDN for the Cohesity Cluster
    type: str

endpoint:
    description:
    - Specifies the network endpoint of the Protection Source where it is reachable. It
      could
    - be an URL or hostname or an IP address of the VMware Protection Source.
    required: true
    type: str

job_name:
    description:
    - Name of the Protection Job
    required: false
    type: str

vm_names:
    description:
    - Array of Virtual Machines to restore
    elements: str
    required: false
    type: list

backup_id:
    description:
    - Optional Cohesity ID to use as source for the Restore operation.  If not selected,
      the most recent RunId will be used
    type: int

datacenter:
    description:
    - If multiple datastore exists, datacenter and cluster resource details are used to
      uniquely identify the resourcepool.
    type: str

network_id:
    description:
    - Specifies a network configuration to be attached to the cloned or recovered object.
      Specify this field to override
    - the preserved network configuration or to attach a new network configuration to
      the cloned or recovered objects. You can
    - get the networkId of the kNetwork object by setting includeNetworks to 'true' in
      the GET /public/protectionSources operation.
    - In the response, get the id of the desired kNetwork object, the resource pool, and
      the registered parent Protection Source.
    type: int

environment:
    choices:
    - VMware
    default: VMware
    description:
    - Specifies the environment type (such as VMware) of the Protection Source this Job
    - is protecting. Supported environment types include 'VMware'
    required: false
    type: str

power_state:
    default: true
    description:
    - Specifies the power state of the cloned or recovered objects. By default, the cloned
      or recovered objects are powered off.
    type: bool

datastore_id:
    description:
    - Specifies the datastore Id where the files should be recovered to. This field is
      required to recover objects to
    - a different resource pool or to a different parent source. If not specified, objects
      are recovered to their original
    - datastore locations in the parent source.
    type: int

network_name:
    description:
    - Specifies a network name to be attached to the cloned or recovered object.
    type: str

vm_folder_id:
    description:
    - Specifies a folder Id where the VMs should be restored.
    type: int

wait_for_job:
    default: true
    description:
    - Should wait until the Restore Job completes
    type: bool

wait_minutes:
    default: 20
    description:
    - Number of minutes to wait until the job completes.
    type: int

cohesity_admin:
    aliases:
    - admin_name
    - cohesity_user
    - username
    description:
    - Username with which Ansible will connect to the Cohesity Cluster. Domain Specific
      credentails can be configured in following formats
    - AD.domain.com/username
    - AD.domain.com/username@tenant
    - LOCAL/username@tenant
    type: str

datastore_name:
    description:
    - Specifies the datastore where the files should be recovered to. This field is required
      to recover objects to
    - a different resource pool or to a different parent source. If not specified, objects
      are recovered to their original
    - datastore locations in the parent source.
    type: str

validate_certs:
    aliases:
    - cohesity_validate_certs
    default: true
    description:
    - Switch determines if SSL Validation should be enabled.
    type: bool

vm_folder_name:
    description:
    - Specifies a folder name where the VMs should be restored.
    type: str

backup_timestamp:
    description:
    - Future option to identify backups based on a timestamp
    - Currently not implemented.
    type: str

resource_pool_id:
    description:
    - Specifies the resource pool Id where the cloned or recovered objects are attached.
    type: int

cohesity_password:
    aliases:
    - password
    - admin_pass
    description:
    - Password belonging to the selected Username.  This parameter will not be logged.
    type: str

network_connected:
    default: true
    description:
    - Specifies whether the network should be left in disabled state. Attached network
      is enabled by default. Set this flag to true to disable it.
    type: bool

restore_to_source:
    description:
    - Switch determines if VM is restored to original source.
    type: bool

resource_pool_name:
    description:
    - Specifies the resource pool name where the cloned or recovered objects are attached.
    type: str

datastore_folder_id:
    description:
    - Specifies the folder where the restore datastore should be created. This is applicable
      only when the VMs are being cloned.
    type: int

interface_group_name:
    description:
    - Specifies the interface name to connect after restoring the VM.
    type: str

recovery_process_type:
    default: InstantRecovery
    description:
    - Specifies the recovery type.
    type: str

cluster_compute_resource:
    description:
    - If the cluster compute resource is specified, VM will be recovered to resource pool
      under the specified compute resource.
    type: str