Using public IP addresses with network interfaces and virtual machines
In this recipe, we will create a virtual machine and network interface using the public IP we created in the recipe, Working with public IP addresses. After creating a virtual machine with the public network interface, we will log into it using SSH. We have already seen how to create a virtual machine in the recipe, Creating an Azure virtual machine. We will also learn how this Ansible task differs from what we learned in the first recipe, Creating an Azure virtual machine.
How do it...
- Create a NIC with the existing public IP address:
- name: Create network interface card using existing public ip address azure_rm_networkinterface: name: nic02 resource_group: example virtual_network_name: vnet01 subnet_name: subnet01 public_ip_address_name: pip01 state: present register: network_interface02 tags: - recipe4
- Create a virtual machine with the existing network interface:
- name: Create VM...