Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] vmware_vmkernel: Support IPv6 #2294

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelogs/fragments/1740-vmware_vmkernel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
minor_changes:
- vmware_vmkernel - Support setting an IPv6 address
(https://github.com/ansible-collections/community.vmware/pull/1740).
36 changes: 25 additions & 11 deletions plugins/modules/vmware_vmkernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,35 @@
ip_address:
type: str
description:
- Static IP address.
- Static IPv4 address.
- Required if O(network.type=static).
subnet_mask:
type: str
description:
- Static netmask required.
- Static IPv4 netmask.
- Required if O(network.type=static).
default_gateway:
type: str
description: Default gateway (Override default gateway for this adapter).
description: Default IPv4 gateway (Override default gateway for this adapter).
tcpip_stack:
type: str
description:
- The TCP/IP stack for the VMKernel interface.
choices: [ 'default', 'provisioning', 'vmotion', 'vxlan' ]
default: 'default'
ipv6_address:
type: str
description:
- Static IPv6 address.
- Required if O(network.ipv6_subnet_mask) is set.
ipv6_subnet_mask:
type: str
description:
- Static IPv6 netmask.
- Required if O(network.ipv6_address) is set.
ipv6_default_gateway:
type: str
description: Default IPv6 gateway (Override default gateway for this adapter).
type: dict
default: {
type: 'static',
Expand Down Expand Up @@ -324,14 +337,6 @@ def __init__(self, module):
msg="Failed to get details of ESXi server. Please specify esxi_hostname."
)

if self.network_type == 'static':
if self.module.params['state'] == 'absent':
pass
elif not self.ip_address:
module.fail_json(msg="ip_address is a required parameter when network type is set to 'static'")
elif not self.subnet_mask:
module.fail_json(msg="subnet_mask is a required parameter when network type is set to 'static'")

# find Port Group
if self.vswitch_name:
self.port_group_obj = self.get_port_group_by_name(
Expand Down Expand Up @@ -1113,12 +1118,21 @@ def main():
ip_address=dict(type='str'),
subnet_mask=dict(type='str'),
default_gateway=dict(type='str'),
ipv6_address=dict(type='str'),
ipv6_subnet_mask=dict(type='str'),
ipv6_default_gateway=dict(type='str'),
tcpip_stack=dict(type='str', default='default', choices=['default', 'provisioning', 'vmotion', 'vxlan']),
),
default=dict(
type='static',
tcpip_stack='default',
),
required_if=[
('type', 'static', ('ip_address', 'subnet_mask'))
],
required_together=[
['ipv6_address', 'ipv6_subnet_mask']
],
),
state=dict(
type='str',
Expand Down
Loading