- name: Ensure there is no ongoing shutdown
  vmware.vmware_rest.appliance_shutdown_info:
  register: result

- ansible.builtin.debug: var=result
- ansible.builtin.assert:
    that:
      - result.value.action == ""

- name: Shutdown the appliance
  vmware.vmware_rest.appliance_shutdown:
    state: poweroff
    reason: this is an example
    delay: 600
  register: result
- ansible.builtin.debug: var=result

- name: Abort the shutdown of the appliance
  vmware.vmware_rest.appliance_shutdown:
    state: cancel
  register: result
- ansible.builtin.debug: var=result

- name: Reboot the appliance
  vmware.vmware_rest.appliance_shutdown:
    state: reboot
    reason: this is an example
    delay: 600
  register: result
- ansible.builtin.debug: var=result

- pause:
    seconds: 10

- name: Get the ongoing shutdown
  vmware.vmware_rest.appliance_shutdown_info:
  register: result

- ansible.builtin.debug: var=result
    
- name: Abort the reboot
  vmware.vmware_rest.appliance_shutdown:
    state: cancel
  register: result
- ansible.builtin.debug: var=result
