diff --git a/plugins/modules/guest.py b/plugins/modules/guest.py index 19afc62d32..7f0821cbb4 100644 --- a/plugins/modules/guest.py +++ b/plugins/modules/guest.py @@ -1119,6 +1119,9 @@ def main(): mutually_exclusive=[ ['cluster', 'esxi_hostname'], ], + required_one_of=[ + ['cluster', 'esxi_hostname'], + ], ) result = {'failed': False, 'changed': False} pyv = PyVmomiHelper(module) diff --git a/tests/integration/targets/guest/tasks/boot_firmware_d1_c1_f0.yml b/tests/integration/targets/guest/tasks/boot_firmware_d1_c1_f0.yml index 75635337f7..0e885beb8d 100644 --- a/tests/integration/targets/guest/tasks/boot_firmware_d1_c1_f0.yml +++ b/tests/integration/targets/guest/tasks/boot_firmware_d1_c1_f0.yml @@ -12,6 +12,7 @@ name: test_vm1 guest_id: centos64Guest datacenter: "{{ dc1 }}" + esxi_hostname: '{{ esxi1 }}' hardware: num_cpus: 1 boot_firmware: "bios" @@ -48,6 +49,7 @@ name: test_vm2 guest_id: centos64Guest datacenter: "{{ dc1 }}" + esxi_hostname: '{{ esxi1 }}' hardware: num_cpus: 1 boot_firmware: "efi" diff --git a/tests/integration/targets/guest/tasks/create_d1_c1_f0.yml b/tests/integration/targets/guest/tasks/create_d1_c1_f0.yml index 7c4b8c8684..18bb15508d 100644 --- a/tests/integration/targets/guest/tasks/create_d1_c1_f0.yml +++ b/tests/integration/targets/guest/tasks/create_d1_c1_f0.yml @@ -12,6 +12,7 @@ name: test_vm1 guest_id: centos64Guest datacenter: "{{ dc1 }}" + esxi_hostname: '{{ esxi1 }}' hardware: num_cpus: 1 num_cpu_cores_per_socket: 1 @@ -59,6 +60,7 @@ name: test_vm1 guest_id: centos64Guest datacenter: "{{ dc1 }}" + esxi_hostname: '{{ esxi1 }}' hardware: num_cpus: 2 memory_mb: 128 @@ -93,6 +95,7 @@ password: "{{ vcenter_password }}" name: test_vm1 datacenter: "{{ dc1 }}" + esxi_hostname: '{{ esxi1 }}' state: absent folder: '{{ f0 }}' register: delete_d1_c1_f0 diff --git a/tests/integration/targets/guest/tasks/create_guest_invalid_d1_c1_f0.yml b/tests/integration/targets/guest/tasks/create_guest_invalid_d1_c1_f0.yml index 17ffb12776..bb28631bc5 100644 --- a/tests/integration/targets/guest/tasks/create_guest_invalid_d1_c1_f0.yml +++ b/tests/integration/targets/guest/tasks/create_guest_invalid_d1_c1_f0.yml @@ -11,6 +11,7 @@ name: invalid_vm guest_id: "invalid_guest_id" datacenter: "{{ dc1 }}" + esxi_hostname: '{{ esxi1 }}' hardware: num_cpus: 1 memory_mb: 128 @@ -21,7 +22,7 @@ - debug: var=invalid_guest_0001_d1_c1_f0 -- name: assert that changes were made +- name: assert that no changes were made assert: that: - "not (invalid_guest_0001_d1_c1_f0 is changed)"