Vmware Vmware: Virtual Machines

Summary

This module contains actions for discovering virtual machines and interacting with them.

Actions

vmware.vms.

create_snapshot

Create a snapshot of the target virtual machine

Minimum Plugin Version: 1.0.0

Input
  • vcenter_connection: a VcenterConnection dictionary

  • vm_uuid: the uuid of the target virtual machine

  • snapshot_name: the name of the snapshot to be created

  • snapshot_description: a description text for your snapshot (Defaults to "")

  • dump_memory: whether you also want to dump memory into the snapshot or not (Defaults to false)

Output

Nothing is outputted by this action.

Example

Create a snapshot:

1
2
3
4
5
- vmware.vms.create_snapshot:
    vm_uuid: c7c8ec5b-309b-4f23-ba8a-b3e2bc524d41
    snapshot_name: my_snapshot
  load:
    vcenter_connection: vcenter_connection_info

vmware.vms.

get_all

List all virtual machines from vCenter

Minimum Plugin Version: 1.0.0

Input
Output

A list of VirtualMachine Dictionaries.

Time consuming operation

This operation can take a bit of time, as it is discovering all the virtual machines and basic data about them.

Example

Retrieve all virtual machines:

1
2
3
4
- vmware.vms.get_all:
  load:
    vcenter_connection: vcenter_connection_info
  save: virtual_machines

vmware.vms.

get_by_name

Get a virtual machine by name

Minimum Plugin Version: 1.0.0

Input
  • vcenter_connection: a VcenterConnection dictionary

  • vm_name: the name of the target virtual machine

Output

A VirtualMachine Dictionaries object.

Example

Retrieve a virtual machine by name:

1
2
3
4
5
- vmware.vms.get_by_name:
    vm_name: test_vm
  load:
    vcenter_connection: vcenter_connection_info
  save: virtual_machine

vmware.vms.

get_by_uuid

Get a virtual machine by uuid

Minimum Plugin Version: 1.0.0

Input
  • vcenter_connection: a VcenterConnection dictionary

  • vm_uuid: the uuid of the target virtual machine

Output

A VirtualMachine Dictionaries object.

Example

Retrieve a virtual machine by uuid:

1
2
3
4
5
- vmware.vms.get_by_uuid:
    vm_uuid: c7c8ec5b-309b-4f23-ba8a-b3e2bc524d41
  load:
    vcenter_connection: vcenter_connection_info
  save: virtual_machine

vmware.vms.

output_table

Display a list of virtual machines in a table. The table will display the chosen keys as columns.

Minimum Plugin Version: 1.0.0

Input
Output

Nothing is outputted by this action.

Example
  • Getting all the virtual machines

  • Saving the results as a new variable called virtual_machines

  • Using this action to show the virtual_machines in a table

1
2
3
4
5
6
7
8
9
- vmware.vms.get_all:
  load:
    vcenter_connection: vcenter_connection_info
  save: virtual_machines

- vmware.vms.output_table:
    text: All virtual machines
  load:
    vm_list: virtual_machines

vmware.vms.

power_off

Power off a virtual machine

Minimum Plugin Version: 1.0.0

Input
  • vcenter_connection: a VcenterConnection dictionary

  • vm_uuid: the uuid of the target virtual machine

Output

Nothing is outputted by this action.

Example

Power off a virtual machine:

1
2
3
4
- vmware.vms.power_off:
    vm_uuid: c7c8ec5b-309b-4f23-ba8a-b3e2bc524d41
  load:
    vcenter_connection: vcenter_connection_info

vmware.vms.

power_on

Power on a virtual machine

Minimum Plugin Version: 1.0.0

Input
  • vcenter_connection: a VcenterConnection dictionary

  • vm_uuid: the uuid of the target virtual machine

Output

Nothing is outputted by this action.

Example

Power on a virtual machine:

1
2
3
4
- vmware.vms.power_on:
    vm_uuid: c7c8ec5b-309b-4f23-ba8a-b3e2bc524d41
  load:
    vcenter_connection: vcenter_connection_info

vmware.vms.

reboot

Reboot a virtual machine (Requires Vmware tools installed)

Minimum Plugin Version: 1.0.0

Input
  • vcenter_connection: a VcenterConnection dictionary

  • vm_uuid: the uuid of the target virtual machine

Output

Nothing is outputted by this action.

Example

Reboot a virtual machine:

1
2
3
4
- vmware.vms.reboot:
    vm_uuid: c7c8ec5b-309b-4f23-ba8a-b3e2bc524d41
  load:
    vcenter_connection: vcenter_connection_info

vmware.vms.

reset

Reset a virtual machine

Minimum Plugin Version: 1.0.0

Input
  • vcenter_connection: a VcenterConnection dictionary

  • vm_uuid: the uuid of the target virtual machine

Output

Nothing is outputted by this action.

Example

Reset a virtual machine:

1
2
3
4
- vmware.vms.reset:
    vm_uuid: c7c8ec5b-309b-4f23-ba8a-b3e2bc524d41
  load:
    vcenter_connection: vcenter_connection_info

vmware.vms.

restore_snapshot

Restore a snapshot of the target virtual machine

Minimum Plugin Version: 1.0.0

Input
  • vcenter_connection: a VcenterConnection dictionary

  • vm_uuid: the uuid of the target virtual machine

  • snapshot_name: the name of the snapshot to be restored

Output

Nothing is outputted by this action.

Example

Restore a snapshot:

1
2
3
4
5
- vmware.vms.restore_snapshot:
    vm_uuid: c7c8ec5b-309b-4f23-ba8a-b3e2bc524d41
    snapshot_name: my_snapshot
  load:
    vcenter_connection: vcenter_connection_info

vmware.vms.

shutdown

Shutdown a virtual machine (Requires Vmware tools installed)

Minimum Plugin Version: 1.0.0

Input
  • vcenter_connection: a VcenterConnection dictionary

  • vm_uuid: the uuid of the target virtual machine

Output

Nothing is outputted by this action.

Example

Shutdown a virtual machine:

1
2
3
4
- vmware.vms.shutdown:
    vm_uuid: c7c8ec5b-309b-4f23-ba8a-b3e2bc524d41
  load:
    vcenter_connection: vcenter_connection_info