Working with public IP addresses
We just created a NIC, but without the public IP, we can't reach that network interface and the virtual machine associated with it from the public internet. In this recipe, we will create a public IP address and associate it with the network interface.
Azure allocates the public IP address using one of two methods, static or dynamic. An IP address allocated with the static method will not change, irrespective of the power cycle of the virtual machine; whereas, an IP address allocated with the dynamic method is subject to change. In this recipe, we will create a public IP address allocated with the Static method.
How to do it...
- Create a public IP:
- name: Create Public IP address azure_rm_publicipaddress: resource_group: example name: pip01 allocation_method: Static domain_name: test state: present register: publicip tag: - recipe3
- Display a public IP:
- name: Show Public IP address debug: msg: "{{ publicip.ip_address...