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

azure_rm_networkinterface ip_configurations does not allow IPv6 addresses #539

Closed
mnj opened this issue May 12, 2021 · 2 comments
Closed

Comments

@mnj
Copy link

mnj commented May 12, 2021

SUMMARY

It's not possible to specify an IPv6 IP in the configurations.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

azure_rm_networkinterface

ANSIBLE VERSION
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/user/.local/lib/python3.8/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.8.5 (default, Jan 27 2021, 15:41:15) [GCC 9.3.0]

CONFIGURATION
      azure_rm_networkinterface: 
        resource_group: rgName
        name: nicName
        virtual_network: vnetName
        subnet: subnetName
        ip_configurations:
          - name: ipconfig1
            primary: yes
            ### Missing a version parameter here, for which internal IP type it should dynamically create??
            public_ip_address_name: public_ipv4_name
          - name: ipconfig2            
            ### Missing a version parameter here, for which internal IP type it should dynamically create??
            public_ip_address_name: public_ipv6_name

OS / ENVIRONMENT

Ubuntu 20.04

STEPS TO REPRODUCE

See above

EXPECTED RESULTS

Working like it does on the portal / as it does with the arm templates, when creating it via an ARM template, you specify the address version:

 "resources": [
        {
            "name": "[parameters('networkInterfaceName')]",
            "type": "Microsoft.Network/networkInterfaces",
            "apiVersion": "2019-07-01",
            "location": "[parameters('location')]",
            "dependsOn": [],
            "properties": {
                "ipConfigurations": [
                    {
                        "name": "ipconfig1",
                        "properties": {
                            "privateIpAddressVersion": "IPv4",
                            "privateIPAllocationMethod": "[parameters('privateIPAllocationMethod')]",
                            "subnet": {
                                "id": "[parameters('subnetId')]"
                            }
                        }
                    },
                    {
                        "name": "[parameters('privateIpv6Address')]",
                        "properties": {
                            "privateIpAddressVersion": "IPv6",
                            "privateIPAllocationMethod": "Dynamic",
                            "subnet": {
                                "id": "[parameters('subnetId')]"
                            }
                        }
                    }
                ]
            },
            "tags": {}
        }
    ]

That is not exposed from the azure_rm_networkinterface module.

ACTUAL RESULTS
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Error creating or updating network interface nicName - Azure Error: IPVersionForPublicIpAndNicIpConfigurationMustMatch\nMessage: IP version for publicIPAddress '/subscriptions/.../resourceGroups/rgName/providers/Microsoft.Network/publicIPAddresses/public_ipv6_name', version 'IPv6' and network interface ipConfiguration '/subscriptions/.../resourceGroups/rgName/providers/Microsoft.Network/networkInterfaces/nicName/ipConfigurations/ipconfig2', version 'IPv4' must match."}

@mnj
Copy link
Author

mnj commented May 12, 2021

Got this workaround working, but it's not anywhere as nice as if this was supported directly with azure_rm_networkinterface

azure_rm_deployment:
  resource_group: "{{ resource_group }}"
  location: "{{ location }}"
  name: manual_nic_deployment
  template:
    $schema: "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#"
    contentVersion: "1.0.0.0"
    resources:
      - type: "Microsoft.Network/networkInterfaces"
        name: "nicName"
        apiVersion: "2019-07-01"
        location: "{{ location }}"
        properties:
          ipConfigurations:
            - name: "ipconfig1"
              properties:
                privateIPAllocationMethod: "Dynamic"
                privateIpAddressVersion: "IPv4"
                subnet:
                  id: "/subscriptions/.../resourceGroups/rgName/providers/Microsoft.Network/virtualNetworks/vnetName/subnets/subnetName"
                publicIPAddress:
                  id: "/subscriptions/.../resourceGroups/rgName/providers/Microsoft.Network/publicIPAddresses/public_ipv4_name"
            - name: "ipconfig2"
              properties:
                privateIPAllocationMethod: "Dynamic"
                privateIpAddressVersion: "IPv6"
                subnet:
                  id: "/subscriptions/.../resourceGroups/rgName/providers/Microsoft.Network/virtualNetworks/vnetName/subnets/subnetName"
                publicIPAddress:
                  id: "/subscriptions/.../resourceGroups/rgName/providers/Microsoft.Network/publicIPAddresses/public_ipv6_name"

@Fred-sun
Copy link
Collaborator

Fred-sun commented Aug 6, 2021

fixes by #582

@Fred-sun Fred-sun closed this as completed Aug 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants