mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
d80b873a69
* vhba template and integration test * SAN Connectivity Policies and integration test * VSANs and integration tests * WWNN/WWPN Pools and integration test * SAN Connectivity Policies only * option description spelled out (aliased to descr) removed docs for list of dictionaries syntax follow ACI indent style state absent only requires dn name match (not full prop match)
132 lines
4.1 KiB
YAML
132 lines
4.1 KiB
YAML
# Test code for the UCS modules
|
|
# Copyright 2017, David Soper (@dsoper2)
|
|
|
|
- name: Test that we have a UCS host, UCS username, and UCS password
|
|
fail:
|
|
msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.'
|
|
when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined
|
|
|
|
|
|
# Setup (clean environment)
|
|
- name: SAN Connectivity Policies absent
|
|
ucs_san_connectivity: &san_connectivity_absent
|
|
hostname: "{{ ucs_hostname }}"
|
|
username: "{{ ucs_username }}"
|
|
password: "{{ ucs_password }}"
|
|
name: Cntr-FC-Boot
|
|
state: absent
|
|
|
|
# Test present (check_mode)
|
|
- name: SAN Connectivity Policies present (check_mode)
|
|
ucs_san_connectivity: &san_connectivity_present
|
|
hostname: "{{ ucs_hostname }}"
|
|
username: "{{ ucs_username }}"
|
|
password: "{{ ucs_password }}"
|
|
name: Cntr-FC-Boot
|
|
wwnn_pool: WWNN-Pool
|
|
vhba_list:
|
|
- name: Fabric-A
|
|
vhba_template: vHBA-Template-A
|
|
adapter_policy: Linux
|
|
- name: Fabric-B
|
|
vhba_template: vHBA-Template-B
|
|
adapter_policy: Linux
|
|
check_mode: yes
|
|
register: cm_san_connectivity_present
|
|
|
|
|
|
# Present (normal mode)
|
|
- name: SAN Connectivity Policies present (normal mode)
|
|
ucs_san_connectivity: *san_connectivity_present
|
|
register: nm_san_connectivity_present
|
|
|
|
|
|
# Test present again (idempotent)
|
|
- name: SAN Connectivity Policies present again (check_mode)
|
|
ucs_san_connectivity: *san_connectivity_present
|
|
check_mode: yes
|
|
register: cm_san_connectivity_present_again
|
|
|
|
|
|
# Present again (normal mode)
|
|
- name: SAN Connectivity Policies present again (normal mode)
|
|
ucs_san_connectivity: *san_connectivity_present
|
|
register: nm_san_connectivity_present_again
|
|
|
|
|
|
# Verfiy present
|
|
- name: Verify SAN Connectivity Policies present results
|
|
assert:
|
|
that:
|
|
- cm_san_connectivity_present.changed == nm_san_connectivity_present.changed == true
|
|
- cm_san_connectivity_present_again.changed == nm_san_connectivity_present_again.changed == false
|
|
|
|
|
|
# Test change (check_mode)
|
|
- name: SAN Connectivity Policies description change (check_mode)
|
|
ucs_san_connectivity: &san_connectivity_change
|
|
<<: *san_connectivity_present
|
|
descr: Testing Ansible
|
|
check_mode: yes
|
|
register: cm_san_connectivity_descr_change
|
|
|
|
|
|
# Change (normal mode)
|
|
- name: SAN Connectivity Policies description change (normal mode)
|
|
ucs_san_connectivity: *san_connectivity_change
|
|
register: nm_san_connectivity_descr_change
|
|
|
|
|
|
# Test change again (idempotent)
|
|
- name: SAN Connectivity Policies description again (check_mode)
|
|
ucs_san_connectivity: *san_connectivity_change
|
|
check_mode: yes
|
|
register: cm_san_connectivity_descr_change_again
|
|
|
|
|
|
# Change again (normal mode)
|
|
- name: SAN Connectivity Policies description change again (normal mode)
|
|
ucs_san_connectivity: *san_connectivity_change
|
|
register: nm_san_connectivity_descr_change_again
|
|
|
|
|
|
# Verfiy change
|
|
- name: Verify SAN Connectivity Policies change results
|
|
assert:
|
|
that:
|
|
- cm_san_connectivity_descr_change.changed == nm_san_connectivity_descr_change.changed == true
|
|
- cm_san_connectivity_descr_change_again.changed == nm_san_connectivity_descr_change_again.changed == false
|
|
|
|
|
|
# Teardown (clean environment)
|
|
- name: SAN Connectivity Policies absent (check_mode)
|
|
ucs_san_connectivity: *san_connectivity_absent
|
|
check_mode: yes
|
|
register: cm_san_connectivity_absent
|
|
|
|
|
|
# Absent (normal mode)
|
|
- name: SAN Connectivity Policies absent (normal mode)
|
|
ucs_san_connectivity: *san_connectivity_absent
|
|
register: nm_san_connectivity_absent
|
|
|
|
|
|
# Test absent again (idempotent)
|
|
- name: SAN Connectivity Policies absent again (check_mode)
|
|
ucs_san_connectivity: *san_connectivity_absent
|
|
check_mode: yes
|
|
register: cm_san_connectivity_absent_again
|
|
|
|
|
|
# Absent again (normal mode)
|
|
- name: SAN Connectivity Policies absent again (normal mode)
|
|
ucs_san_connectivity: *san_connectivity_absent
|
|
register: nm_san_connectivity_absent_again
|
|
|
|
|
|
# Verfiy absent
|
|
- name: Verify SAN Connectivity Policies absent results
|
|
assert:
|
|
that:
|
|
- cm_san_connectivity_absent.changed == nm_san_connectivity_absent.changed == true
|
|
- cm_san_connectivity_absent_again.changed == nm_san_connectivity_absent_again.changed == false
|