From dc2eb0549168f55a66084a660043d477c6edf30f Mon Sep 17 00:00:00 2001 From: Christian Kotte Date: Fri, 19 Oct 2018 15:54:34 +0200 Subject: [PATCH] VMware: Add check mode support to vmware_vmkernel_facts (#47286) --- .../cloud/vmware/vmware_vmkernel_facts.py | 3 ++- .../vmware_vmkernel_facts/tasks/main.yml | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/cloud/vmware/vmware_vmkernel_facts.py b/lib/ansible/modules/cloud/vmware/vmware_vmkernel_facts.py index 87c36f61ff0..bda8de87851 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_vmkernel_facts.py +++ b/lib/ansible/modules/cloud/vmware/vmware_vmkernel_facts.py @@ -189,7 +189,8 @@ def main(): argument_spec=argument_spec, required_one_of=[ ['cluster_name', 'esxi_hostname'], - ] + ], + supports_check_mode=True ) vmware_vmk_config = VmkernelFactsManager(module) diff --git a/test/integration/targets/vmware_vmkernel_facts/tasks/main.yml b/test/integration/targets/vmware_vmkernel_facts/tasks/main.yml index 179154a7ea9..1c71afb8436 100644 --- a/test/integration/targets/vmware_vmkernel_facts/tasks/main.yml +++ b/test/integration/targets/vmware_vmkernel_facts/tasks/main.yml @@ -45,7 +45,7 @@ - debug: var=host1 -- name: Gather VNICs facts about all hosts in given cluster +- name: Gather VMkernel facts about all hosts in given cluster vmware_vmkernel_facts: hostname: "{{ vcsim }}" username: "{{ user }}" @@ -59,3 +59,19 @@ - assert: that: - host_vmkernel.host_vmk_facts is defined + +- name: Gather VMkernel facts about all hosts in given cluster in check mode + vmware_vmkernel_facts: + hostname: "{{ vcsim }}" + username: "{{ user }}" + password: "{{ passwd }}" + esxi_hostname: "{{ host1 }}" + validate_certs: no + register: host_vmkernel_check_mode + check_mode: yes + +- debug: var=host_vmkernel + +- assert: + that: + - host_vmkernel_check_mode.host_vmk_facts is defined