diff --git a/lib/ansible/modules/cloud/vmware/vmware_host_firewall_facts.py b/lib/ansible/modules/cloud/vmware/vmware_host_firewall_facts.py index ecd69e2c65..9f4dcb3c9d 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_host_firewall_facts.py +++ b/lib/ansible/modules/cloud/vmware/vmware_host_firewall_facts.py @@ -143,7 +143,8 @@ def main(): argument_spec=argument_spec, required_one_of=[ ['cluster_name', 'esxi_hostname'], - ] + ], + supports_check_mode=True ) vmware_host_firewall = FirewallFactsManager(module) diff --git a/test/integration/targets/vmware_host_firewall_facts/tasks/main.yml b/test/integration/targets/vmware_host_firewall_facts/tasks/main.yml index aaa9611262..af3fc8a09b 100644 --- a/test/integration/targets/vmware_host_firewall_facts/tasks/main.yml +++ b/test/integration/targets/vmware_host_firewall_facts/tasks/main.yml @@ -80,3 +80,33 @@ that: - "not firewall_0002_results.changed" - "firewall_0002_results.hosts_firewall_facts is defined" + +- name: Gather firewall facts for all ESXi host from given cluster in check mode + vmware_host_firewall_facts: + hostname: "{{ vcsim }}" + username: "{{ vcsim_instance.json.username }}" + password: "{{ vcsim_instance.json.password }}" + validate_certs: no + cluster_name: "{{ ccr1 }}" + register: firewall_0003_results + check_mode: yes + +- assert: + that: + - "not firewall_0003_results.changed" + - "firewall_0003_results.hosts_firewall_facts is defined" + +- name: Gather firewall facts for ESXi host in check mode + vmware_host_firewall_facts: + hostname: "{{ vcsim }}" + username: "{{ vcsim_instance.json.username }}" + password: "{{ vcsim_instance.json.password }}" + validate_certs: no + esxi_hostname: "{{ host1 }}" + register: firewall_0004_results + check_mode: yes + +- assert: + that: + - "not firewall_0004_results.changed" + - "firewall_0004_results.hosts_firewall_facts is defined"