From 2e25638abcf6704efd5ad7a159dd1335dd788821 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ne=C4=8Das?= Date: Tue, 2 Jul 2019 11:59:52 +0200 Subject: [PATCH] Ovirt add vm cloud init ipv6 (#58112) * update cloud init ipv6 * update examples cloud init * add ipv6 docs version added --- lib/ansible/modules/cloud/ovirt/ovirt_vm.py | 59 +++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/lib/ansible/modules/cloud/ovirt/ovirt_vm.py b/lib/ansible/modules/cloud/ovirt/ovirt_vm.py index 0b3df61756f..38b1cae6945 100644 --- a/lib/ansible/modules/cloud/ovirt/ovirt_vm.py +++ b/lib/ansible/modules/cloud/ovirt/ovirt_vm.py @@ -441,6 +441,20 @@ options: nic_gateway: description: - If boot protocol is static, set this gateway to network interface of Virtual Machine. + nic_boot_protocol_v6: + description: + - Set boot protocol of the network interface of Virtual Machine. + choices: ['none', 'dhcp', 'static'] + nic_ip_address_v6: + description: + - If boot protocol is static, set this IP address to network interface of Virtual Machine. + nic_netmask_v6: + description: + - If boot protocol is static, set this netmask to network interface of Virtual Machine. + nic_gateway_v6: + description: + - If boot protocol is static, set this gateway to network interface of Virtual Machine. + - For IPv6 addresses the value is an integer in the range of 0-128, which represents the subnet prefix. nic_name: description: - Set name to network interface of Virtual Machine. @@ -467,6 +481,23 @@ options: nic_gateway: description: - If boot protocol is static, set this gateway to network interface of Virtual Machine. + nic_boot_protocol_v6: + description: + - Set boot protocol of the network interface of Virtual Machine. Can be one of C(none), C(dhcp) or C(static). + version_added: "2.9" + nic_ip_address_v6: + description: + - If boot protocol is static, set this IP address to network interface of Virtual Machine. + version_added: "2.9" + nic_netmask_v6: + description: + - If boot protocol is static, set this netmask to network interface of Virtual Machine. + version_added: "2.9" + nic_gateway_v6: + description: + - If boot protocol is static, set this gateway to network interface of Virtual Machine. + - For IPv6 addresses the value is an integer in the range of 0-128, which represents the subnet prefix. + version_added: "2.9" nic_name: description: - Set name to network interface of Virtual Machine. @@ -971,6 +1002,16 @@ EXAMPLES = ''' nic_netmask: 255.255.252.0 nic_gateway: 10.34.63.254 nic_on_boot: true + # IP version 6 parameters are supported since ansible 2.9 + - nic_name: eth2 + nic_boot_protocol_v6: static + nic_ip_address_v6: '2620:52:0:2282:b898:1f69:6512:36c5' + nic_gateway_v6: '2620:52:0:2282:b898:1f69:6512:36c9' + nic_netmask_v6: '120' + nic_on_boot: true + - nic_name: eth3 + nic_on_boot: true + nic_boot_protocol_v6: dhcp - name: Run VM with sysprep ovirt_vm: @@ -1932,20 +1973,38 @@ class VmsModule(BaseModule): boot_protocol=otypes.BootProtocol( nic.pop('nic_boot_protocol').lower() ) if nic.get('nic_boot_protocol') else None, + ipv6_boot_protocol=otypes.BootProtocol( + nic.pop('nic_boot_protocol_v6').lower() + ) if nic.get('nic_boot_protocol_v6') else None, name=nic.pop('nic_name', None), on_boot=nic.pop('nic_on_boot', None), ip=otypes.Ip( address=nic.pop('nic_ip_address', None), netmask=nic.pop('nic_netmask', None), gateway=nic.pop('nic_gateway', None), + version=otypes.IpVersion('v4') ) if ( nic.get('nic_gateway') is not None or nic.get('nic_netmask') is not None or nic.get('nic_ip_address') is not None ) else None, + ipv6=otypes.Ip( + address=nic.pop('nic_ip_address_v6', None), + netmask=nic.pop('nic_netmask_v6', None), + gateway=nic.pop('nic_gateway_v6', None), + version=otypes.IpVersion('v6') + ) if ( + nic.get('nic_gateway_v6') is not None or + nic.get('nic_netmask_v6') is not None or + nic.get('nic_ip_address_v6') is not None + ) else None, ) for nic in cloud_init_nics if ( + nic.get('nic_boot_protocol_v6') is not None or + nic.get('nic_ip_address_v6') is not None or + nic.get('nic_gateway_v6') is not None or + nic.get('nic_netmask_v6') is not None or nic.get('nic_gateway') is not None or nic.get('nic_netmask') is not None or nic.get('nic_ip_address') is not None or