|
65 | 65 | ip_address:
|
66 | 66 | type: str
|
67 | 67 | description:
|
68 |
| - - Static IP address. |
| 68 | + - Static IPv4 address. |
69 | 69 | - Required if O(network.type=static).
|
70 | 70 | subnet_mask:
|
71 | 71 | type: str
|
72 | 72 | description:
|
73 |
| - - Static netmask required. |
| 73 | + - Static IPv4 netmask. |
74 | 74 | - Required if O(network.type=static).
|
75 | 75 | default_gateway:
|
76 | 76 | type: str
|
77 |
| - description: Default gateway (Override default gateway for this adapter). |
| 77 | + description: Default IPv4 gateway (Override default gateway for this adapter). |
78 | 78 | tcpip_stack:
|
79 | 79 | type: str
|
80 | 80 | description:
|
81 | 81 | - The TCP/IP stack for the VMKernel interface.
|
82 | 82 | choices: [ 'default', 'provisioning', 'vmotion', 'vxlan' ]
|
83 | 83 | 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). |
84 | 97 | type: dict
|
85 | 98 | default: {
|
86 | 99 | type: 'static',
|
@@ -324,14 +337,6 @@ def __init__(self, module):
|
324 | 337 | msg="Failed to get details of ESXi server. Please specify esxi_hostname."
|
325 | 338 | )
|
326 | 339 |
|
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 |
| - |
335 | 340 | # find Port Group
|
336 | 341 | if self.vswitch_name:
|
337 | 342 | self.port_group_obj = self.get_port_group_by_name(
|
@@ -1113,12 +1118,19 @@ def main():
|
1113 | 1118 | ip_address=dict(type='str'),
|
1114 | 1119 | subnet_mask=dict(type='str'),
|
1115 | 1120 | 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'), |
1116 | 1124 | tcpip_stack=dict(type='str', default='default', choices=['default', 'provisioning', 'vmotion', 'vxlan']),
|
1117 | 1125 | ),
|
1118 | 1126 | default=dict(
|
1119 | 1127 | type='static',
|
1120 | 1128 | tcpip_stack='default',
|
1121 | 1129 | ),
|
| 1130 | + required_together=[ |
| 1131 | + ['ip_address', 'subnet_mask'], |
| 1132 | + ['ipv6_address', 'ipv6_subnet_mask'] |
| 1133 | + ] |
1122 | 1134 | ),
|
1123 | 1135 | state=dict(
|
1124 | 1136 | type='str',
|
|
0 commit comments