Skip to content

Commit 8a908d4

Browse files
committed
vmware_vmkernel: Support IPv6
1 parent af13893 commit 8a908d4

File tree

2 files changed

+28
-11
lines changed

2 files changed

+28
-11
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
minor_changes:
2+
- vmware_vmkernel - Support setting an IPv6 address
3+
(https://github.com/ansible-collections/community.vmware/pull/1740).

plugins/modules/vmware_vmkernel.py

+25-11
Original file line numberDiff line numberDiff line change
@@ -65,22 +65,35 @@
6565
ip_address:
6666
type: str
6767
description:
68-
- Static IP address.
68+
- Static IPv4 address.
6969
- Required if O(network.type=static).
7070
subnet_mask:
7171
type: str
7272
description:
73-
- Static netmask required.
73+
- Static IPv4 netmask.
7474
- Required if O(network.type=static).
7575
default_gateway:
7676
type: str
77-
description: Default gateway (Override default gateway for this adapter).
77+
description: Default IPv4 gateway (Override default gateway for this adapter).
7878
tcpip_stack:
7979
type: str
8080
description:
8181
- The TCP/IP stack for the VMKernel interface.
8282
choices: [ 'default', 'provisioning', 'vmotion', 'vxlan' ]
8383
default: 'default'
84+
ipv6_address:
85+
type: str
86+
description:
87+
- Static IPv6 address.
88+
- Required if O(network.ipv6_subnet_mask) is set.
89+
ipv6_subnet_mask:
90+
type: str
91+
description:
92+
- Static IPv6 netmask.
93+
- Required if O(network.ipv6_address) is set.
94+
ipv6_default_gateway:
95+
type: str
96+
description: Default IPv6 gateway (Override default gateway for this adapter).
8497
type: dict
8598
default: {
8699
type: 'static',
@@ -324,14 +337,6 @@ def __init__(self, module):
324337
msg="Failed to get details of ESXi server. Please specify esxi_hostname."
325338
)
326339

327-
if self.network_type == 'static':
328-
if self.module.params['state'] == 'absent':
329-
pass
330-
elif not self.ip_address:
331-
module.fail_json(msg="ip_address is a required parameter when network type is set to 'static'")
332-
elif not self.subnet_mask:
333-
module.fail_json(msg="subnet_mask is a required parameter when network type is set to 'static'")
334-
335340
# find Port Group
336341
if self.vswitch_name:
337342
self.port_group_obj = self.get_port_group_by_name(
@@ -1113,12 +1118,21 @@ def main():
11131118
ip_address=dict(type='str'),
11141119
subnet_mask=dict(type='str'),
11151120
default_gateway=dict(type='str'),
1121+
ipv6_address=dict(type='str'),
1122+
ipv6_subnet_mask=dict(type='str'),
1123+
ipv6_default_gateway=dict(type='str'),
11161124
tcpip_stack=dict(type='str', default='default', choices=['default', 'provisioning', 'vmotion', 'vxlan']),
11171125
),
11181126
default=dict(
11191127
type='static',
11201128
tcpip_stack='default',
11211129
),
1130+
required_if=[
1131+
('type', 'static', ('ip_address', 'subnet_mask'))
1132+
],
1133+
required_together=[
1134+
['ipv6_address', 'ipv6_subnet_mask']
1135+
],
11221136
),
11231137
state=dict(
11241138
type='str',

0 commit comments

Comments
 (0)