VMware: Improve vmware_portgroup (#56382)

* Rewrite vmware_portgroup module
* support check mode
* VLAN ID isn't required anymore
* VLAN ID 0 (no tagging) is the default
* Options match values in vSphere Client and vmware_vswitch module
* Policy override is configured properly
* VMware: vmware_portgroup updates
This commit is contained in:
Abhijeet Kasurde 2019-05-14 14:34:43 +05:30 committed by GitHub
parent 5b4cd227d7
commit 7a32bd8080
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 900 additions and 282 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,3 @@
cloud/vcenter
shippable/vcenter/group1
needs/target/prepare_vmware_tests

View file

@ -0,0 +1,68 @@
# Test code for the vmware_portgroup module.
# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
- when: vcsim is not defined
block:
- debug: var=ccr1
- debug: var=host1
- name: Create portgroup without Portgroup and vSwitch
vmware_portgroup:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
validate_certs: no
ignore_errors: yes
register: no_pg_vs
- assert:
that:
- '"missing" in no_pg_vs.msg'
- name: Create portgroup without Portgroup
vmware_portgroup:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
vswitch: ''
validate_certs: no
ignore_errors: yes
register: no_vs
- assert:
that:
- '"missing" in no_vs.msg'
- name: Create portgroup without cluster
vmware_portgroup:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
vswitch: 'vSwitch_03'
portgroup: 'pg_03'
validate_certs: no
ignore_errors: yes
register: no_cluster
- assert:
that:
- '"cluster_name" in no_cluster.msg'
- name: Create portgroup
vmware_portgroup:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
vswitch: 'vSwitch_03'
portgroup: 'pg_03'
cluster_name: "{{ ccr1 }}"
validate_certs: no
state: present
ignore_errors: yes
register: pg_info
- assert:
that:
- pg_info.changed