
Hi Jayme, here's my idea. I haven't tested it but I believe it should work. 1. Create a new task file (let's call it export_vm.yaml) and include two tasks in there: 1.1. First task uses ovirt_vm module (pretty much what you already have) to export VM 1.2. Second task uses wait_for <https://docs.ansible.com/ansible/latest/modules/wait_for_module.html> module (specifically its path parameter) to wait until the OVA file in /backup exists 2. Loop over those two tasks as explained here <https://ericsysmin.com/2019/06/20/how-to-loop-blocks-of-code-in-ansible/>. Hope this helps. Jan On Wed, Jan 22, 2020 at 4:15 PM Jayme <jaymef@gmail.com> wrote:
I wrote a simple task that is using the ovirt_vm module https://docs.ansible.com/ansible/latest/modules/ovirt_vm_module.html -- it essentially loops over a list of vms and exports them to OVA.
The problem I have is the task is deemed changed once it successfully submits the export task to oVirt. This means that if I gave it a list of 100 Vms I believe it would start an export task on all of them. I want to prevent this and have it only export one VM at a time. In order to do this I believe I will need to find a way for the task to wait and somehow verify that the export was completed before submitting a task for the next VM export.
Any ideas?
- name: Export the VM ovirt_vm: auth: "{{ ovirt_auth }}" name: "{{ item }}" state: exported cluster: default export_ova: host: Host0 filename: "{{ item }}" directory: /backup/ with_items: "{{ vms }}"
_______________________________________________ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-leave@ovirt.org Privacy Statement: https://www.ovirt.org/site/privacy-policy/ oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/PXYAQ7YEBQCUWC...
-- Jan Zmeskal Quality Engineer, RHV Core System Red Hat <https://www.redhat.com> <https://www.redhat.com>