Skip to content

Commit

Permalink
Using ansible.builtin.fail when trying to restart non-existent VM in …
Browse files Browse the repository at this point in the history
…`powerstate` role
  • Loading branch information
AllRWeak authored and bl0way committed Feb 5, 2024
1 parent d02db25 commit b869ca0
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions nova/core/roles/powerstate/vsphere/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,10 @@
retries: 5
delay: 2

- name: Stopping play if the VM doesn't exist...
- name: ERROR
ansible.builtin.fail:
msg: "{{ custom_vm_name | default(vm_name) }} VM not found!"
when: vcenter_vm_info.value == []
block:
- name: INFO
ansible.builtin.debug:
msg: "{{ custom_vm_name | default(vm_name) }} VM doesn't exist!"

- name: Stopping play...
ansible.builtin.meta: end_host

- name: Waiting until VMTools are running for {{ custom_vm_name | default(vm_name) }}...
vmware.vmware_rest.vcenter_vm_tools_info:
Expand Down

0 comments on commit b869ca0

Please sign in to comment.