@ -202,9 +202,11 @@ options:
- If a public IP address is created when creating the VM ( because a Network Interface was not provided ) ,
- If a public IP address is created when creating the VM ( because a Network Interface was not provided ) ,
determines if the public IP address remains permanently associated with the Network Interface . If set
determines if the public IP address remains permanently associated with the Network Interface . If set
to ' Dynamic ' the public IP address may change any time the VM is rebooted or power cycled .
to ' Dynamic ' the public IP address may change any time the VM is rebooted or power cycled .
- The C ( Disabled ) choice was added in Ansible 2.6 .
choices :
choices :
- Dynamic
- Dynamic
- Static
- Static
- Disabled
default :
default :
- Static
- Static
aliases :
aliases :
@ -646,7 +648,7 @@ class AzureRMVirtualMachine(AzureRMModuleBase):
default = ' ReadOnly ' ) ,
default = ' ReadOnly ' ) ,
managed_disk_type = dict ( type = ' str ' , choices = [ ' Standard_LRS ' , ' Premium_LRS ' ] ) ,
managed_disk_type = dict ( type = ' str ' , choices = [ ' Standard_LRS ' , ' Premium_LRS ' ] ) ,
os_type = dict ( type = ' str ' , choices = [ ' Linux ' , ' Windows ' ] , default = ' Linux ' ) ,
os_type = dict ( type = ' str ' , choices = [ ' Linux ' , ' Windows ' ] , default = ' Linux ' ) ,
public_ip_allocation_method = dict ( type = ' str ' , choices = [ ' Dynamic ' , ' Static ' ], default = ' Static ' ,
public_ip_allocation_method = dict ( type = ' str ' , choices = [ ' Dynamic ' , ' Static ' , ' Disabled ' ], default = ' Static ' ,
aliases = [ ' public_ip_allocation ' ] ) ,
aliases = [ ' public_ip_allocation ' ] ) ,
open_ports = dict ( type = ' list ' ) ,
open_ports = dict ( type = ' list ' ) ,
network_interface_names = dict ( type = ' list ' , aliases = [ ' network_interfaces ' ] ) ,
network_interface_names = dict ( type = ' list ' , aliases = [ ' network_interfaces ' ] ) ,
@ -1641,8 +1643,11 @@ class AzureRMVirtualMachine(AzureRMModuleBase):
if not subnet_id :
if not subnet_id :
self . fail ( no_subnets_msg )
self . fail ( no_subnets_msg )
self . results [ ' actions ' ] . append ( ' Created default public IP {0} ' . format ( self . name + ' 01 ' ) )
pip = None
pip = self . create_default_pip ( self . resource_group , self . location , self . name + ' 01 ' , self . public_ip_allocation_method )
if self . public_ip_allocation_method != ' Disabled ' :
self . results [ ' actions ' ] . append ( ' Created default public IP {0} ' . format ( self . name + ' 01 ' ) )
pip_info = self . create_default_pip ( self . resource_group , self . location , self . name + ' 01 ' , self . public_ip_allocation_method )
pip = self . network_models . PublicIPAddress ( id = pip_info . id , location = pip_info . location , resource_guid = pip_info . resource_guid )
self . results [ ' actions ' ] . append ( ' Created default security group {0} ' . format ( self . name + ' 01 ' ) )
self . results [ ' actions ' ] . append ( ' Created default security group {0} ' . format ( self . name + ' 01 ' ) )
group = self . create_default_securitygroup ( self . resource_group , self . location , self . name + ' 01 ' , self . os_type ,
group = self . create_default_securitygroup ( self . resource_group , self . location , self . name + ' 01 ' , self . os_type ,
@ -1661,9 +1666,7 @@ class AzureRMVirtualMachine(AzureRMModuleBase):
parameters . network_security_group = self . network_models . NetworkSecurityGroup ( id = group . id ,
parameters . network_security_group = self . network_models . NetworkSecurityGroup ( id = group . id ,
location = group . location ,
location = group . location ,
resource_guid = group . resource_guid )
resource_guid = group . resource_guid )
parameters . ip_configurations [ 0 ] . public_ip_address = self . network_models . PublicIPAddress ( id = pip . id ,
parameters . ip_configurations [ 0 ] . public_ip_address = pip
location = pip . location ,
resource_guid = pip . resource_guid )
self . log ( " Creating NIC {0} " . format ( network_interface_name ) )
self . log ( " Creating NIC {0} " . format ( network_interface_name ) )
self . log ( self . serialize_obj ( parameters , ' NetworkInterface ' ) , pretty_print = True )
self . log ( self . serialize_obj ( parameters , ' NetworkInterface ' ) , pretty_print = True )