diff options
| author | spmfox <spmfox@foxwd.com> | 2023-05-28 10:02:07 -0400 |
|---|---|---|
| committer | spmfox <spmfox@foxwd.com> | 2023-05-28 10:02:07 -0400 |
| commit | ff35c64d337a286ac2864c8403c1840e28bb23b1 (patch) | |
| tree | 36062b6fbe326b61c5abaa11721f4a909364af5a /roles/libvirt/tasks/vm-check-duplicate.yml | |
| parent | efebf42259944acef6389937736995a0af8c17d5 (diff) | |
Initial commit
Diffstat (limited to 'roles/libvirt/tasks/vm-check-duplicate.yml')
| -rw-r--r-- | roles/libvirt/tasks/vm-check-duplicate.yml | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/roles/libvirt/tasks/vm-check-duplicate.yml b/roles/libvirt/tasks/vm-check-duplicate.yml new file mode 100644 index 0000000..5070cfd --- /dev/null +++ b/roles/libvirt/tasks/vm-check-duplicate.yml @@ -0,0 +1,10 @@ +- name: Fetch list of all VMs + community.libvirt.virt: + command: list_vms + register: vms_list + +- name: Fail if VM exists + ansible.builtin.fail: + msg: "VM {{ libvirt_vm_name }} is already in-use." + when: libvirt_vm_name | string in vms_list.list_vms + |
