Create and attach additional Azure Nic

How can we add additional Azure NICs to a VM , while it is being built.

Sometimes we have a need for more than 1 NIC to be used to a VM, being built.

Current code for

  • name: Create a network interface with dns servers
    azure_rm_networkinterface:
    name: “{{ hostname }}-nic1”
    state: present
    resource_group: ‘{{ server.az_vm_rg }}’
    virtual_network:
    name: ‘{{ server.az_nic_vnet }}’
    resource_group: ‘{{ server.az_vnet_rg }}’
    subnet_name: ‘{{ server.az_nic_subnet }}’
    public_ip: false
    dns_servers:
  • ‘{{ server.dnsserver1 }}’
  • ‘{{ server.dnsserver2 }}’
  • ‘{{ server.dnsserver3 }}’
    ip_configurations:
  • name: lan1
    primary: True
    private_ip_allocation_method: Static
    private_ip_address: ‘{{ server.az_vm_ipaddress }}’
    application_security_groups: ‘{{ server.az_vm_asg }}’
    create_with_security_group: false
    #tags: ‘{{ server.az_vm_tags }}’
    register: azure_nic Thanks