|
|
@ -17,9 +17,9 @@ ANSIBLE_METADATA = {
|
|
|
|
DOCUMENTATION = r'''
|
|
|
|
DOCUMENTATION = r'''
|
|
|
|
---
|
|
|
|
---
|
|
|
|
module: vmware_dvs_portgroup_find
|
|
|
|
module: vmware_dvs_portgroup_find
|
|
|
|
short_description: Find portgroup(s) in a vmware environment
|
|
|
|
short_description: Find portgroup(s) in a VMware environment
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Find portgroup(s) based on different criteria such as dvswitch, vlan id or a string in the name.
|
|
|
|
- Find portgroup(s) based on different criteria such as distributed vSwitch, VLAN id or a string in the name.
|
|
|
|
version_added: 2.9
|
|
|
|
version_added: 2.9
|
|
|
|
author:
|
|
|
|
author:
|
|
|
|
- David Martinez (@dx0xm)
|
|
|
|
- David Martinez (@dx0xm)
|
|
|
@ -31,12 +31,12 @@ requirements:
|
|
|
|
options:
|
|
|
|
options:
|
|
|
|
dvswitch:
|
|
|
|
dvswitch:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Name of a dvswitch to look for.
|
|
|
|
- Name of a distributed vSwitch to look for.
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
vlanid:
|
|
|
|
vlanid:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- vlan id can be any number between 1 and 4094.
|
|
|
|
- VLAN id can be any number between 1 and 4094.
|
|
|
|
- This search criteria will looks into vlan ranges to find possible matches.
|
|
|
|
- This search criteria will looks into VLAN ranges to find possible matches.
|
|
|
|
required: false
|
|
|
|
required: false
|
|
|
|
type: int
|
|
|
|
type: int
|
|
|
|
name:
|
|
|
|
name:
|
|
|
@ -56,16 +56,21 @@ extends_documentation_fragment: vmware.documentation
|
|
|
|
EXAMPLES = r'''
|
|
|
|
EXAMPLES = r'''
|
|
|
|
- name: Get all portgroups in dvswitch vDS
|
|
|
|
- name: Get all portgroups in dvswitch vDS
|
|
|
|
vmware_dvs_portgroup_find:
|
|
|
|
vmware_dvs_portgroup_find:
|
|
|
|
hostname: 172.16.143.150
|
|
|
|
hostname: "{{ vcenter_hostname }}"
|
|
|
|
username: admin
|
|
|
|
username: "{{ vcenter_username }}"
|
|
|
|
password: password
|
|
|
|
password: "{{ vcenter_password }}"
|
|
|
|
dvswitch: 'vDS'
|
|
|
|
dvswitch: 'vDS'
|
|
|
|
|
|
|
|
validate_certs: no
|
|
|
|
|
|
|
|
delegate_to: localhost
|
|
|
|
|
|
|
|
|
|
|
|
- name: Confirm if vlan 15 is present
|
|
|
|
- name: Confirm if vlan 15 is present
|
|
|
|
vmware_dvs_portgroup_find:
|
|
|
|
vmware_dvs_portgroup_find:
|
|
|
|
hostname: 172.16.143.150
|
|
|
|
hostname: "{{ vcenter_hostname }}"
|
|
|
|
username: admin
|
|
|
|
username: "{{ vcenter_username }}"
|
|
|
|
password: password
|
|
|
|
password: "{{ vcenter_password }}"
|
|
|
|
vlanid: '15'
|
|
|
|
vlanid: '15'
|
|
|
|
|
|
|
|
validate_certs: no
|
|
|
|
|
|
|
|
delegate_to: localhost
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
|
RETURN = r'''
|
|
|
|
RETURN = r'''
|
|
|
@ -194,7 +199,9 @@ def main():
|
|
|
|
module = AnsibleModule(
|
|
|
|
module = AnsibleModule(
|
|
|
|
argument_spec=argument_spec,
|
|
|
|
argument_spec=argument_spec,
|
|
|
|
supports_check_mode=True,
|
|
|
|
supports_check_mode=True,
|
|
|
|
required_if=[['show_uplink', 'True', 'vlanid']]
|
|
|
|
required_if=[
|
|
|
|
|
|
|
|
['show_uplink', 'True', 'vlanid']
|
|
|
|
|
|
|
|
]
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
dvs_pg_mgr = DVSPortgroupFindManager(module)
|
|
|
|
dvs_pg_mgr = DVSPortgroupFindManager(module)
|
|
|
|