vmware_guest_snapshot - Manages virtual machines snapshots in vcenter
New in version 2.3.
Synopsis
- Create virtual machines snapshots
Requirements (on host that executes module)
- python >= 2.6
- PyVmomi
Options
parameter | required | default | choices | comments |
---|---|---|---|---|
datacenter | yes | Destination datacenter for the deploy operation | ||
description | no | Define an arbitrary description to attach to snapshot. | ||
folder | no | /vm | Destination folder, absolute or relative path to find an existing guest. This is required if name is supplied. The folder should include the datacenter. ESX's datacenter is ha-datacenter Examples: folder: /ha-datacenter/vm folder: ha-datacenter/vm folder: /datacenter1/vm folder: datacenter1/vm folder: /datacenter1/vm/folder1 folder: datacenter1/vm/folder1 folder: /folder1/datacenter1/vm folder: folder1/datacenter1/vm folder: /folder1/datacenter1/vm/folder2 folder: vm/folder2 folder: folder2 | |
hostname | yes | The hostname or IP address of the vSphere vCenter. | ||
memory_dump (added in 2.4)
| no | If set to true , memory dump of virtual machine is also included in snapshot.Note that memory snapshots take time and resources, this will take longer time to create. If virtual machine does not provide capability to take memory snapshot, then this flag is set to false . | ||
name | no | Name of the VM to work with This is required if uuid is not supplied. | ||
name_match | no | first |
| If multiple VMs matching the name, use the first or last found |
password | yes | The password of the vSphere vCenter. aliases: pass, pwd | ||
quiesce (added in 2.4)
| no | If set to true and virtual machine is powered on, it will quiesce the file system in virtual machine.Note that VMWare Tools are required for this flag. If virtual machine is powered off or VMware Tools are not available, then this flag is set to false .If virtual machine does not provide capability to take quiesce snapshot, then this flag is set to false . | ||
remove_children (added in 2.4)
| no | If set to true and state is set to absent , then entire snapshot subtree is set for removal. | ||
snapshot_name | no | Sets the snapshot name to manage. This param is required only if state is not remove_all
| ||
state | yes |
| Manage snapshots attached to a specific virtual machine. | |
username | yes | The username of the vSphere vCenter. aliases: user, admin | ||
uuid | no | UUID of the instance to manage if known, this is VMware's unique identifier. This is required if name is not supplied. | ||
validate_certs | no | True |
| Allows connection when SSL certificates are not valid. Set to false when certificates are not trusted. |
Examples
- name: Create snapshot vmware_guest_snapshot: hostname: 192.168.1.209 username: [email protected] password: vmware datacenter: datacenter_name folder: /myfolder name: dummy_vm state: present snapshot_name: snap1 description: snap1_description delegate_to: localhost - name: Remove a snapshot vmware_guest_snapshot: hostname: 192.168.1.209 username: [email protected] password: vmware name: dummy_vm datacenter: datacenter_name folder: /myfolder state: remove snapshot_name: snap1 delegate_to: localhost - name: Revert to a snapshot vmware_guest_snapshot: hostname: 192.168.1.209 username: [email protected] password: vmware datacenter: datacenter_name folder: /myfolder name: dummy_vm state: revert snapshot_name: snap1 delegate_to: localhost - name: Remove all snapshots of a VM vmware_guest_snapshot: hostname: 192.168.1.209 username: [email protected] password: vmware datacenter: datacenter_name folder: /myfolder name: dummy_vm state: remove_all delegate_to: localhost - name: Take snapshot of a VM using quiesce and memory flag on vmware_guest_snapshot: hostname: 192.168.1.209 username: [email protected] password: vmware name: dummy_vm state: present snapshot_name: dummy_vm_snap_0001 quiesce: True memory_dump: True delegate_to: localhost - name: Remove a snapshot and snapshot subtree vmware_guest_snapshot: hostname: 192.168.1.209 username: [email protected] password: vmware name: dummy_vm state: remove remove_children: True snapshot_name: snap1 delegate_to: localhost
Return Values
Common return values are documented here Return Values, the following are the fields unique to this module:
name | description | returned | type | sample |
---|---|---|---|---|
instance | metadata about the new virtualmachine | always | dict | None |
Notes
Note
- Tested on vSphere 5.5
Status
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.4/vmware_guest_snapshot_module.html