From 986be77337ad072c95c36f4ee859d0acef596bd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A9ri=20Le=20Bouder?= Date: Mon, 20 Jan 2020 01:01:25 -0500 Subject: [PATCH] vmware_host_powermgmt_policy/test: just one esxi (#66515) Since the run the test playbook in a vcenter+1esxi scenario, there is no need of second host. The commit also simplify the logic of the test. --- .../tasks/main.yml | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) 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