ovirt / ovirt.ovirt_collection / 1.0.2 / module / ovirt_snapshot Module to manage Virtual Machine Snapshots in oVirt/RHV | "added in version" 1.0.0 of ovirt.ovirt_collection" Authors: Ondra Machacek (@machacekondra), Martin Necas (@mnecas) preview | supported by communityovirt.ovirt_collection.ovirt_snapshot (1.0.2) — module
Install with ansible-galaxy collection install ovirt.ovirt_collection:==1.0.2
collections: - name: ovirt.ovirt_collection version: 1.0.2
Module to manage Virtual Machine Snapshots in oVirt/RHV
# Examples don't contain auth parameter for simplicity, # look at ovirt_auth module to see how to reuse authentication: # Create snapshot: - ovirt_snapshot: vm_name: rhel7 description: MySnapshot register: snapshot
# Create snapshot and save memory: - ovirt_snapshot: vm_name: rhel7 description: SnapWithMem use_memory: true register: snapshot
# Restore snapshot: - ovirt_snapshot: state: restore vm_name: rhel7 snapshot_id: "{{ snapshot.id }}"
# Remove snapshot: - ovirt_snapshot: state: absent vm_name: rhel7 snapshot_id: "{{ snapshot.id }}"
# Upload local image to disk and attach it to vm: # Since Ansible 2.8 - ovirt_snapshot: name: mydisk vm_name: myvm upload_image_path: /path/to/mydisk.qcow2
# Download snapshot to local file system: # Since Ansible 2.8 - ovirt_snapshot: snapshot_id: 7de90f31-222c-436c-a1ca-7e655bd5b60c disk_name: DiskName vm_name: myvm download_image_path: /home/user/mysnaphost.qcow2
# Delete all snapshots older than 2 days - ovirt_snapshot: vm_name: test keep_days_old: 2
- name: Select which disks should be add to snapshot ovirt_snapshot: vm_name: test disks: - id: 7de90f31-222c-436c-a1ca-7e655bd5b60c - name: my_disk_name
auth: description: - 'Dictionary with values needed to create HTTP/HTTPS connection to oVirt:' required: true suboptions: ca_file: description: - A PEM file containing the trusted CA certificates. - The certificate presented by the server will be verified using these CA certificates. - If C(ca_file) parameter is not set, system wide CA certificate store is used. - Default value is set by C(OVIRT_CAFILE) environment variable. type: str headers: description: - Dictionary of HTTP headers to be added to each API call. type: dict hostname: description: - A string containing the hostname of the server, usually something like `I(server.example.com)`. - Default value is set by C(OVIRT_HOSTNAME) environment variable. - Either C(url) or C(hostname) is required. type: str insecure: description: - A boolean flag that indicates if the server TLS certificate and host name should be checked. type: bool kerberos: description: - A boolean flag indicating if Kerberos authentication should be used instead of the default basic authentication. type: bool password: description: - The password of the user. - Default value is set by C(OVIRT_PASSWORD) environment variable. required: true type: str token: description: - Token to be used instead of login with username/password. - Default value is set by C(OVIRT_TOKEN) environment variable. type: str url: description: - A string containing the API URL of the server, usually something like `I(https://server.example.com/ovirt-engine/api)`. - Default value is set by C(OVIRT_URL) environment variable. - Either C(url) or C(hostname) is required. type: str username: description: - The name of the user, something like I(admin@internal). - Default value is set by C(OVIRT_USERNAME) environment variable. required: true type: str type: dict wait: default: true description: - C(yes) if the module should wait for the entity to get into desired state. type: bool disks: description: - List of disks which should be created with snapshot. suboptions: id: description: - Id of the disk which should will be created. type: str name: description: - Name of the disk which should will be created. type: str type: list state: choices: - restore - present - absent default: present description: - Should the Virtual Machine snapshot be restore/present/absent. disk_id: description: - Disk id which you want to upload or download - To get disk, you need to define disk_id or disk_name timeout: default: 180 description: - The amount of time in seconds the module should wait for the instance to get into desired state. type: int vm_name: description: - Name of the Virtual Machine to manage. required: true disk_name: description: - Disk name which you want to upload or download use_memory: aliases: - restore_memory - save_memory description: - If I(true) and C(state) is I(present) save memory of the Virtual Machine if it's running. - If I(true) and C(state) is I(restore) restore memory of the Virtual Machine. - Note that Virtual Machine will be paused while saving the memory. type: bool description: description: - Description of the snapshot. snapshot_id: description: - ID of the snapshot to manage. fetch_nested: description: - If I(True) the module will fetch additional data from the API. - It will fetch IDs of the VMs disks, snapshots, etc. User can configure to fetch other attributes of the nested entities by specifying C(nested_attributes). type: bool keep_days_old: description: - Number of days after which should snapshot be deleted. - It will check all snapshots of virtual machine and delete them, if they are older. poll_interval: default: 3 description: - Number of the seconds the module waits until another poll request on entity status is sent. type: int nested_attributes: description: - Specifies list of the attributes which should be fetched from the API. - This parameter apply only when C(fetch_nested) is I(true). type: list upload_image_path: description: - Path to disk image, which should be uploaded. download_image_path: description: - Path on a file system where snapshot should be downloaded. - Note that you must have an valid oVirt/RHV engine CA in your system trust store or you must provide it in C(ca_file) parameter. - Note that the snapshot is not downloaded when the file already exists, but you can forcibly download the snapshot when using C(force) I (true).
id: description: ID of the snapshot which is managed returned: On success if snapshot is found. sample: 7de90f31-222c-436c-a1ca-7e655bd5b60c type: str snapshot: description: 'Dictionary of all the snapshot attributes. Snapshot attributes can be found on your oVirt/RHV instance at following url: http://ovirt.github.io/ovirt-engine-api-model/master/#types/snapshot.' returned: On success if snapshot is found. type: dict snapshots: description: List of deleted snapshots when keep_days_old is defined and snapshot is older than the input days returned: On success returns deleted snapshots type: list