Debian Codegraph @

ansible_collections/community/vmware/tests/integration/targets/vmware_dvswitch_pvlans/tasks/main.yml

raw
1 # Test code for the vmware_dvswitch_pvlans module.
2 # Copyright: (c) 2018, Christian Kotte <[email protected]>
3 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
4
5 - import_role:
6 name: prepare_vmware_tests
7
8 # Testcase 0001: Add Distributed vSwitch
9 - name: add distributed vSwitch
10 vmware_dvswitch:
11 validate_certs: false
12 hostname: "{{ vcenter_hostname }}"
13 username: "{{ vcenter_username }}"
14 password: "{{ vcenter_password }}"
15 datacenter_name: "{{ dc1 }}"
16 state: present
17 switch_name: dvswitch_0001
18 mtu: 9000
19 uplink_quantity: 2
20 discovery_proto: lldp
21 discovery_operation: both
22 register: dvs_result_0001
23
24 - debug:
25 var: dvs_result_0001
26
27 - name: ensure distributed vswitch is present
28 assert:
29 that:
30 - dvs_result_0001 is changed
31
32 - &pv_data
33 name: Configure PVLANs
34 vmware_dvswitch_pvlans:
35 hostname: "{{ vcenter_hostname }}"
36 username: "{{ vcenter_username }}"
37 password: "{{ vcenter_password }}"
38 switch: dvswitch_0001
39 primary_pvlans:
40 - primary_pvlan_id: 1
41 - primary_pvlan_id: 4
42 secondary_pvlans:
43 - primary_pvlan_id: 1
44 secondary_pvlan_id: 2
45 pvlan_type: isolated
46 - primary_pvlan_id: 1
47 secondary_pvlan_id: 3
48 pvlan_type: community
49 - primary_pvlan_id: 4
50 secondary_pvlan_id: 5
51 pvlan_type: community
52 validate_certs: false
53 register: pvlans_result
54
55 - debug:
56 var: pvlans_result
57
58 - name: ensure pvlans were configured
59 assert:
60 that:
61 - pvlans_result is changed
62
63 - <<: *pv_data
64 name: Configure PVLANs in check mode
65 register: pvlans_result_check_mode
66 check_mode: true
67 - debug:
68 var: pvlans_result_check_mode
69 - name: ensure pvlans were not changed
70 assert:
71 that:
72 - not (pvlans_result_check_mode is changed)