mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-02 06:30:19 -07:00
VMware: Set default network type as 'dhcp' (#38518)
If user does not specify any network type then set network type to dhcp. There are additional checks around 'ip', 'netmask' and 'type' in network spec. Fixes: #38466 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
53a3b8b602
commit
9b139baacb
2 changed files with 43 additions and 10 deletions
|
@ -218,7 +218,7 @@ options:
|
|||
- ' - C(device_type) (string): Virtual network device (one of C(e1000), C(e1000e), C(pcnet32), C(vmxnet2), C(vmxnet3) (default), C(sriov)).'
|
||||
- ' - C(mac) (string): Customize MAC address.'
|
||||
- 'Optional parameters per entry (used for OS customization):'
|
||||
- ' - C(type) (string): Type of IP assignment (either C(dhcp) or C(static)).'
|
||||
- ' - C(type) (string): Type of IP assignment (either C(dhcp) or C(static)). C(dhcp) is default.'
|
||||
- ' - C(ip) (string): Static IP address (implies C(type: static)).'
|
||||
- ' - C(netmask) (string): Static netmask required for C(ip).'
|
||||
- ' - C(gateway) (string): Static gateway.'
|
||||
|
@ -1019,6 +1019,9 @@ class PyVmomiHelper(PyVmomi):
|
|||
# network type as 'static'
|
||||
if 'ip' in network or 'netmask' in network:
|
||||
network['type'] = 'static'
|
||||
else:
|
||||
# User wants network type as 'dhcp'
|
||||
network['type'] = 'dhcp'
|
||||
|
||||
if network.get('type') == 'static':
|
||||
if 'ip' in network and 'netmask' not in network:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue