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.
This commit is contained in:
Gonéri Le Bouder 2020-01-20 01:01:25 -05:00 committed by Abhijeet Kasurde
parent 2d0ccdc98c
commit 986be77337

View file

@ -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