Error restore snapshots ovirt ansible

28 views
Skip to first unread message

Antonio Jimenez Ramirez

unread,
Aug 1, 2017, 9:08:45 AM8/1/17
to Ansible Project
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

Kai Stian Olstad

unread,
Aug 1, 2017, 9:46:40 AM8/1/17
to ansible...@googlegroups.com
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.


--
Kai Stian Olstad

Antonio Jimenez Ramirez

unread,
Aug 2, 2017, 2:45:17 AM8/2/17
to Ansible Project
In the documentation the example he puts is:


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

Kai Stian Olstad

unread,
Aug 2, 2017, 4:35:43 AM8/2/17
to ansible...@googlegroups.com
On 02. aug. 2017 08:45, Antonio Jimenez Ramirez wrote:
> In the documentation the example he puts is:
>
> http://docs.ansible.com/ansible/latest/ovirt_snapshots_module.html
>
> # Restore snapshot:- ovirt_snapshots:
> state: restore
> vm_name: rhel7
> snapshot_id: "{{ snapshot.id }}"

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.


--
Kai Stian Olstad
Reply all
Reply to author
Forward
0 new messages