diff --git a/test/integration/targets/vmware_host_powermgmt_policy/tasks/main.yml b/test/integration/targets/vmware_host_powermgmt_policy/tasks/main.yml index 0c2b408010a..c899e7a6684 100644 --- a/test/integration/targets/vmware_host_powermgmt_policy/tasks/main.yml +++ b/test/integration/targets/vmware_host_powermgmt_policy/tasks/main.yml @@ -9,6 +9,15 @@ vars: setup_attach_host: true + - name: Reset all the hosts to balanced + vmware_host_powermgmt_policy: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + cluster_name: "{{ ccr1 }}" + policy: balanced + validate_certs: no + # The following test cases aren't supported by vcsim - name: Set the Power Management Policy for esxi1 vmware_host_powermgmt_policy: @@ -25,7 +34,7 @@ that: - host_result.result['{{ esxi1 }}'].current_state == "high-performance" - - name: Set the Power Management Policy on all hosts of {{ ccr1 }} + - name: Reset all the hosts to balanced vmware_host_powermgmt_policy: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" @@ -41,6 +50,15 @@ - all_hosts_result is changed - all_hosts_result.result is defined + - name: Reset all the hosts to balanced + vmware_host_powermgmt_policy: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + cluster_name: "{{ ccr1 }}" + policy: balanced + validate_certs: no + - name: Set the Power Management Policy for esxi1 in check mode vmware_host_powermgmt_policy: hostname: "{{ vcenter_hostname }}" @@ -74,4 +92,12 @@ that: - not (all_hosts_result is changed) - "all_hosts_result.result['{{ esxi1 }}'].current_state == 'balanced'" - - "all_hosts_result.result['{{ esxi2 }}'].current_state == 'balanced'" + always: + - name: Reset all the hosts to balanced + vmware_host_powermgmt_policy: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + cluster_name: "{{ ccr1 }}" + policy: balanced + validate_certs: no