Description of problem: Role fails when vms: [] It should finish successfully. Version-Release number of selected component (if applicable): ovirt-ansible-vm-infra-1.1.8-1.el7ev.noarch How reproducible: always Steps to Reproduce: 1. run role vm-infra with 'vms: []' Actual results: failed Expected results: should success Additional info: TASK [ovirt-vm-infra : Create VMs] ************************************* task path: /usr/share/ansible/roles/oVirt.vm-infra/tasks/main.yml:21 TASK [ovirt-vm-infra : Wait for VMs to be added] ************************************************************************ task path: /usr/share/ansible/roles/oVirt.vm-infra/tasks/main.yml:27 fatal: [localhost]: FAILED! => { "msg": "'all_vms' is undefined" }
Is there any reason why the role should finish successfully when there are no VMs to be created/started? Shouldn't we rather make error message more clear, that users needs to specify at least 1 VM in vms option? Or am I missing something?
I'm creating vms list dynamically using this role and in some rare cases it could happen that my dynamic list is empty. I can workaround it by testing: 'when: vms is not []' when I'm including this role, but at first I expected that if there isn't any change (any VM to create) it should pass as with "ok" or "skipped" to next tasks, because 'do nothing' isn't an error state in this case. But I understand your point of view about specifying at least 1 VM in vms and clear error message to explicitly say to users that they don't create any VMs.
Verified ovirt-ansible-vm-infra-1.1.10-0.1.master.20180815145127.el7.noarch