Skip to content

Commit

Permalink
Improve integration tests readability
Browse files Browse the repository at this point in the history
  • Loading branch information
mariolenz committed Sep 19, 2022
1 parent fc42ad8 commit ca0ae4e
Showing 1 changed file with 29 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,28 @@
vars:
setup_attach_host: true

- name: Gather firewall info for all ESXi host from given cluster
community.vmware.vmware_host_firewall_info:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: false
cluster_name: "{{ ccr1 }}"
register: firewall_0001_results

- debug: msg="{{ firewall_0001_results }}"

- name: Enable vvold rule set on all hosts of {{ ccr1 }}
community.vmware.vmware_host_firewall_manager:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: false
cluster_name: "{{ ccr1 }}"
rules:
- name: vvold
enabled: true
allowed_hosts:
all_ip: true
register: all_hosts_result

- debug: msg="{{ all_hosts_result }}"

- name: ensure everything is changed for all hosts of {{ ccr1 }}
assert:
that:
Expand Down Expand Up @@ -47,7 +55,9 @@
- name: vvold
enabled: false
register: host_result

- debug: msg="{{ host_result }}"

- name: ensure vvold is disabled for {{ host1 }}
assert:
that:
Expand Down Expand Up @@ -77,7 +87,9 @@
all_ip: true
register: all_hosts_result_check_mode
check_mode: true

- debug: var=all_hosts_result_check_mode

- name: ensure everything is changed for all hosts of {{ ccr1 }}
assert:
that:
Expand All @@ -103,7 +115,9 @@
enabled: false
register: host_result_check_mode
check_mode: true

- debug: msg="{{ host_result_check_mode }}"

- name: ensure vvold is disabled for {{ host1 }}
assert:
that:
Expand Down Expand Up @@ -137,7 +151,9 @@
ip_network:
- "192.168.200.0/24"
register: all_hosts_ip_specific

- debug: var=all_hosts_ip_specific

- name: ensure everything is changed for all hosts of {{ ccr1 }}
assert:
that:
Expand Down Expand Up @@ -180,10 +196,14 @@
ip_address:
- "192.168.100.11"
register: single_host_ip_specific

- set_fact:
nfc_state: "{{ single_host_ip_specific.rule_set_state[esxi1]['NFC'] }}"

- debug: var=single_host_ip_specific

- debug: var=nfc_state

- name: ensure NFC is configured on that host
assert:
that:
Expand Down Expand Up @@ -215,13 +235,17 @@
ip_address:
- "1.2.3.4"
register: using_list

- debug: var=using_list

- set_fact:
nfc_state: "{{ using_list.rule_set_state[esxi1]['NFC'] }}"

- name: ensure the correct host is set
assert:
that:
- nfc_state.allowed_hosts.current_allowed_ip == ["1.2.3.4"]

- name: Clean up the firewall rules
community.vmware.vmware_host_firewall_manager:
cluster_name: '{{ ccr1 }}'
Expand Down

0 comments on commit ca0ae4e

Please sign in to comment.