@ -19,6 +19,18 @@
name : vNIC-A-B
state : absent
- name : vNIC primary template absent
ucs_vnic_template : &vnic_primary_templates_absent
<< : *login_info
name : vNIC-A
state : absent
- name : vNIC secondary template absent
ucs_vnic_template : &vnic_secondary_templates_absent
<< : *login_info
name : vNIC-B
state : absent
# Test present (check_mode)
- name : vNIC template present (check_mode)
@ -29,16 +41,53 @@
vlans_list:
- name : default
native : 'yes'
- name : finance
- name : 10
check_mode : yes
register : cm_vnic_templates_present
- name : vNIC primary template present (check_mode)
ucs_vnic_template : &vnic_primary_templates_present
<< : *login_info
name : vNIC-A
fabric : A
redundancy_type : primary
peer_redundancy_templ : vNIC-B
template_type : updating-template
mtu : '9000'
mac_pool : MAC-Pool-A
network_control_policy : Enable-CDP-LLDP
vlans_list:
- name : default
native : 'yes'
- name : finance
check_mode : yes
register : cm_vnic_primary_templates_present
- name : vNIC secondary template present (check_mode)
ucs_vnic_template : &vnic_secondary_templates_present
<< : *login_info
name : vNIC-B
fabric : B
redundancy_type : secondary
peer_redundancy_templ : vNIC-A
mac_pool : MAC-Pool-B
check_mode : yes
register : cm_vnic_secondary_templates_present
# Present (normal mode)
- name : vNIC template present (normal mode)
ucs_vnic_template : *vnic_templates_present
register : nm_vnic_templates_present
- name : vNIC primary template present (normal mode)
ucs_vnic_template : *vnic_primary_templates_present
register : nm_vnic_primary_templates_present
- name : vNIC secondary template present (normal mode)
ucs_vnic_template : *vnic_secondary_templates_present
register : nm_vnic_secondary_templates_present
# Test present again (idempotent)
- name : vNIC template present again (check_mode)
@ -46,12 +95,30 @@
check_mode : yes
register : cm_vnic_templates_present_again
- name : vNIC primary template present again (check_mode)
ucs_vnic_template : *vnic_primary_templates_present
check_mode : yes
register : cm_vnic_primary_templates_present_again
- name : vNIC secondary template present again (check_mode)
ucs_vnic_template : *vnic_secondary_templates_present
check_mode : yes
register : cm_vnic_secondary_templates_present_again
# Present again (normal mode)
- name : vNIC template present again (normal mode)
ucs_vnic_template : *vnic_templates_present
register : nm_vnic_templates_present_again
- name : vNIC primary template present again (normal mode)
ucs_vnic_template : *vnic_primary_templates_present
register : nm_vnic_primary_templates_present_again
- name : vNIC secondary template present again (normal mode)
ucs_vnic_template : *vnic_secondary_templates_present
register : nm_vnic_secondary_templates_present_again
# Verfiy present
- name : Verify vNIC template present results
@ -59,42 +126,50 @@
that:
- cm_vnic_templates_present.changed == nm_vnic_templates_present.changed == true
- cm_vnic_templates_present_again.changed == nm_vnic_templates_present_again.changed == false
- cm_vnic_primary_templates_present.changed == nm_vnic_primary_templates_present.changed == true
- cm_vnic_primary_templates_present_again.changed == nm_vnic_primary_templates_present_again.changed == false
- cm_vnic_secondary_templates_present.changed == nm_vnic_secondary_templates_present.changed == true
- cm_vnic_secondary_templates_present_again.changed == nm_vnic_secondary_templates_present_again.changed == false
# Test change (check_mode)
- name : vNIC template description change (check_mode)
- name : vNIC template change (check_mode)
ucs_vnic_template : &vnic_templates_change
<< : *vnic_templates_present
descr : Testing Ansible
vlans_list:
- name : default
native : 'yes'
- name : 10
state : absent
check_mode : yes
register : cm_vnic_templates_descr_change
register : cm_vnic_templates_ change
# Change (normal mode)
- name : vNIC template description change (normal mode)
- name : vNIC template change (normal mode)
ucs_vnic_template : *vnic_templates_change
register : nm_vnic_templates_ descr_ change
register : nm_vnic_templates_ change
# Test change again (idempotent)
- name : vNIC template description again (check_mode)
- name : vNIC template change again (check_mode)
ucs_vnic_template : *vnic_templates_change
check_mode : yes
register : cm_vnic_templates_ descr_ change_again
register : cm_vnic_templates_ change_again
# Change again (normal mode)
- name : vNIC template description change again (normal mode)
- name : vNIC template change again (normal mode)
ucs_vnic_template : *vnic_templates_change
register : nm_vnic_templates_ descr_ change_again
register : nm_vnic_templates_ change_again
# Verfiy change
- name : Verify vNIC template change results
assert:
that:
- cm_vnic_templates_ descr_ change.changed == nm_vnic_templates_descr _change.changed == true
- cm_vnic_templates_ descr_ change_again.changed == nm_vnic_templates_descr _change_again.changed == false
- cm_vnic_templates_ change.changed == nm_vnic_templates_change.changed == true
- cm_vnic_templates_ change_again.changed == nm_vnic_templates_change_again.changed == false
# Teardown (clean environment)
@ -103,12 +178,30 @@
check_mode : yes
register : cm_vnic_templates_absent
- name : vNIC primary template absent (check_mode)
ucs_vnic_template : *vnic_primary_templates_absent
check_mode : yes
register : cm_vnic_primary_templates_absent
- name : vNIC secondary template absent (check_mode)
ucs_vnic_template : *vnic_secondary_templates_absent
check_mode : yes
register : cm_vnic_secondary_templates_absent
# Absent (normal mode)
- name : vNIC template absent (normal mode)
ucs_vnic_template : *vnic_templates_absent
register : nm_vnic_templates_absent
- name : vNIC primary template absent (normal mode)
ucs_vnic_template : *vnic_primary_templates_absent
register : nm_vnic_primary_templates_absent
- name : vNIC secondary template absent (normal mode)
ucs_vnic_template : *vnic_secondary_templates_absent
register : nm_vnic_secondary_templates_absent
# Test absent again (idempotent)
- name : vNIC template absent again (check_mode)
@ -116,12 +209,30 @@
check_mode : yes
register : cm_vnic_templates_absent_again
- name : vNIC primary template absent again (check_mode)
ucs_vnic_template : *vnic_primary_templates_absent
check_mode : yes
register : cm_vnic_primary_templates_absent_again
- name : vNIC secondary template absent again (check_mode)
ucs_vnic_template : *vnic_secondary_templates_absent
check_mode : yes
register : cm_vnic_secondary_templates_absent_again
# Absent again (normal mode)
- name : vNIC template absent again (normal mode)
ucs_vnic_template : *vnic_templates_absent
register : nm_vnic_templates_absent_again
- name : vNIC primary template absent again (normal mode)
ucs_vnic_template : *vnic_primary_templates_absent
register : nm_vnic_primary_templates_absent_again
- name : vNIC secondary template absent again (normal mode)
ucs_vnic_template : *vnic_secondary_templates_absent
register : nm_vnic_secondary_templates_absent_again
# Verfiy absent
- name : Verify vNIC template absent results
@ -129,3 +240,7 @@
that:
- cm_vnic_templates_absent.changed == nm_vnic_templates_absent.changed == true
- cm_vnic_templates_absent_again.changed == nm_vnic_templates_absent_again.changed == false
- cm_vnic_primary_templates_absent.changed == nm_vnic_primary_templates_absent.changed == true
- cm_vnic_primary_templates_absent_again.changed == nm_vnic_primary_templates_absent_again.changed == false
- cm_vnic_secondary_templates_absent.changed == nm_vnic_secondary_templates_absent.changed == true
- cm_vnic_secondary_templates_absent_again.changed == nm_vnic_secondary_templates_absent_again.changed == false