mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
2307797a76
Refactoring of the following roles to make use of the new `prepare_vmware_tests` role. - `vmware_drs_group` - `vmware_drs_group_facts` - `vmware_drs_rule_facts` - `vmware_drs_portgroup` - `vmware_drs_portgroup_facts` - `vmware_dvs_portgroup_facts` - `vmware_dvswitch` - `vmware_dvswitch_pvlans` This patch depends on: https://github.com/ansible/ansible/pull/55719 Original PR: https://github.com/ansible/ansible/pull/54882
74 lines
1.8 KiB
YAML
74 lines
1.8 KiB
YAML
# Test code for the vmware_dvswitch_pvlans module.
|
|
# Copyright: (c) 2018, Christian Kotte <christian.kotte@gmx.de>
|
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
- import_role:
|
|
name: prepare_vmware_tests
|
|
|
|
# Testcase 0001: Add Distributed vSwitch
|
|
- name: add distributed vSwitch
|
|
vmware_dvswitch:
|
|
validate_certs: False
|
|
hostname: "{{ vcenter_hostname }}"
|
|
username: "{{ vcenter_username }}"
|
|
password: "{{ vcenter_password }}"
|
|
datacenter_name: "{{ dc1 }}"
|
|
state: present
|
|
switch_name: dvswitch_0001
|
|
mtu: 9000
|
|
uplink_quantity: 2
|
|
discovery_proto: lldp
|
|
discovery_operation: both
|
|
register: dvs_result_0001
|
|
|
|
- debug:
|
|
var: dvs_result_0001
|
|
|
|
- name: ensure distributed vswitch is present
|
|
assert:
|
|
that:
|
|
- dvs_result_0001 is changed
|
|
|
|
- &pv_data
|
|
name: Configure PVLANs
|
|
vmware_dvswitch_pvlans:
|
|
hostname: "{{ vcenter_hostname }}"
|
|
username: "{{ vcenter_username }}"
|
|
password: "{{ vcenter_password }}"
|
|
switch: dvswitch_0001
|
|
primary_pvlans:
|
|
- primary_pvlan_id: 1
|
|
- primary_pvlan_id: 4
|
|
secondary_pvlans:
|
|
- primary_pvlan_id: 1
|
|
secondary_pvlan_id: 2
|
|
pvlan_type: isolated
|
|
- primary_pvlan_id: 1
|
|
secondary_pvlan_id: 3
|
|
pvlan_type: community
|
|
- primary_pvlan_id: 4
|
|
secondary_pvlan_id: 5
|
|
pvlan_type: community
|
|
validate_certs: no
|
|
register: pvlans_result
|
|
|
|
- debug:
|
|
var: pvlans_result
|
|
|
|
- name: ensure pvlans were configured
|
|
assert:
|
|
that:
|
|
- pvlans_result is changed
|
|
|
|
- <<: *pv_data
|
|
name: Configure PVLANs in check mode
|
|
register: pvlans_result_check_mode
|
|
check_mode: yes
|
|
|
|
- debug:
|
|
var: pvlans_result_check_mode
|
|
|
|
- name: ensure pvlans were configured
|
|
assert:
|
|
that:
|
|
- pvlans_result_check_mode is changed
|