-
Notifications
You must be signed in to change notification settings - Fork 334
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
Allow IPv6 with NetworkInterfaceIPConfiguration #582
Allow IPv6 with NetworkInterfaceIPConfiguration #582
Conversation
@imrejonk Thanks for your contribution. Can you add test cases for the newly added feature? Thank you very much! |
No problem, I'll add some test cases next week. I just got service principal authentication working for ansible-test and am now doing some trial runs with the existing integration tests. |
b2de5fb
to
e22c298
Compare
@Fred-sun I've modified the Some things to note:
Let me know if this is sufficient, and if not, what types of additional tests you would like to see. |
tests/integration/targets/azure_rm_networkinterface/tasks/main.yml
Outdated
Show resolved
Hide resolved
tests/integration/targets/azure_rm_networkinterface/tasks/main.yml
Outdated
Show resolved
Hide resolved
The ip_configurations parameter of the azure_rm_networkinterface module did not allow specifying the IP version, causing the Azure REST API to default to IPv4. Trying to add a public IPv6 address to the network interface would cause this error: ``` Error creating or updating network interface mynic - Azure Error: IPVersionForPublicIpAndNicIpConfigurationMustMatch Message: IP version for publicIPAddress '/subscriptions/[..]/resourceGroups/ansible/providers/Microsoft.Network/publicIPAddresses/mypublicipv6address', version 'IPv6' and network interface ipConfiguration '/subscriptions/[..]/resourceGroups/ansible/providers/Microsoft.Network/networkInterfaces/mynic/ipConfigurations/myipv6config', version 'IPv4' must match. ``` The Azure Python SDK however does allow for a parameter called `private_ip_address_version` [0]. This commit implements that parameter for the azure_rm_networkinterface module. [1] https://docs.microsoft.com/en-us/python/api/azure-mgmt-network/azure.mgmt.network.v2020_06_01.models.networkinterfaceipconfiguration?view=azure-python
e22c298
to
af28e0a
Compare
@Fred-sun here you go, style issues fixed. |
LGTM |
) The ip_configurations parameter of the azure_rm_networkinterface module did not allow specifying the IP version, causing the Azure REST API to default to IPv4. Trying to add a public IPv6 address to the network interface would cause this error: ``` Error creating or updating network interface mynic - Azure Error: IPVersionForPublicIpAndNicIpConfigurationMustMatch Message: IP version for publicIPAddress '/subscriptions/[..]/resourceGroups/ansible/providers/Microsoft.Network/publicIPAddresses/mypublicipv6address', version 'IPv6' and network interface ipConfiguration '/subscriptions/[..]/resourceGroups/ansible/providers/Microsoft.Network/networkInterfaces/mynic/ipConfigurations/myipv6config', version 'IPv4' must match. ``` The Azure Python SDK however does allow for a parameter called `private_ip_address_version` [0]. This commit implements that parameter for the azure_rm_networkinterface module. [1] https://docs.microsoft.com/en-us/python/api/azure-mgmt-network/azure.mgmt.network.v2020_06_01.models.networkinterfaceipconfiguration?view=azure-python
SUMMARY
The ip_configurations parameter of the azure_rm_networkinterface module did not allow specifying the IP version, causing the Azure REST API to default to IPv4. Trying to add a public IPv6 address to the network interface would cause this error:
The Azure Python SDK however does allow for a parameter called
private_ip_address_version
. This commit implements that parameter for the azure_rm_networkinterface module.ISSUE TYPE
COMPONENT NAME
azure_rm_networkinterface
ADDITIONAL INFORMATION
You can now do this:
And I can remove an ugly workaround involving an Ansible
command
task that just called azure-cli to add IPv6 configurations to network interfaces 😊