# Error restore snapshots ovirt ansible

**URL:** <https://forum.ansible.com/t/error-restore-snapshots-ovirt-ansible/25149>\
**Category:** Ansible Project\
**Created:** [August 1, 2017, 1:08pm UTC](https://forum.ansible.com/t/error-restore-snapshots-ovirt-ansible/25149 "2017-08-01T13:08:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Antonio\_Jimenez\_Rami](https://avatars.discourse-cdn.com/v4/letter/a/f1d935/32.png) [@Antonio\_Jimenez\_Rami](https://forum.ansible.com/u/Antonio_Jimenez_Rami)\
**Post date:** [August 1, 2017, 1:08pm UTC](https://forum.ansible.com/t/error-restore-snapshots-ovirt-ansible/25149/1 "2017-08-01T13:08:45Z")

</div>

I have the next playbooks:

- ovirt\_snapshots:  
auth: “{{ ovirt\_auth }}”  
state: restore  
vm\_name: dlitest02  
snapshot\_id: “{{ snapshot.id }}”

but when i run the playbook the error is:

TASK [ovirt\_snapshots] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [localhost]: FAILED! =\> {“failed”: true, “msg”: “the field ‘args’ has an invalid value, which appears to include a variable that is undefined. The error was: ‘snapshot’ is undefined\n\nThe error appears to have been in ‘/etc/ansible/ovirt/ovirt-restore-snapshot.yml’: line 14, column 11, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - ovirt\_snapshots:\n ^ here\n”}

Does the virtual machine have to be turned off?

Thanks

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [August 1, 2017, 1:46pm UTC](https://forum.ansible.com/t/error-restore-snapshots-ovirt-ansible/25149/2 "2017-08-01T13:46:09Z")

</div>

The error message is saying what is wrong:

"... has an invalid value, which appears to include a variable that is undefined. The error was: 'snapshot' is undefined"

So you will need to define the variable snapshot somewhere in you code.

---

<div class="post-metadata">

**Author:** ![Antonio\_Jimenez\_Rami](https://avatars.discourse-cdn.com/v4/letter/a/f1d935/32.png) [@Antonio\_Jimenez\_Rami](https://forum.ansible.com/u/Antonio_Jimenez_Rami)\
**Post date:** [August 2, 2017, 6:45am UTC](https://forum.ansible.com/t/error-restore-snapshots-ovirt-ansible/25149/3 "2017-08-02T06:45:17Z")

</div>

In the documentation the example he puts is:

[http://docs.ansible.com/ansible/latest/ovirt\_snapshots\_module.html](http://docs.ansible.com/ansible/latest/ovirt_snapshots_module.html)

```auto
# Restore snapshot:
- ovirt_snapshots:
    state: restore
    vm_name: rhel7
    snapshot_id: "{{ snapshot.id }}"

```

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [August 2, 2017, 8:35am UTC](https://forum.ansible.com/t/error-restore-snapshots-ovirt-ansible/25149/4 "2017-08-02T08:35:10Z")

</div>

If you look at the two examples before that you see they create a snapshot and register the output in a variable snapshot.

Thats why they can use "{{ snapshot.id }}" as the id of what snapshot to manage. If you do not have a variable you will need to provide the id some other way.
