@ -185,6 +185,14 @@ options:
- When a default security group is created for a Linux host a rule will be added allowing inbound TCP
- When a default security group is created for a Linux host a rule will be added allowing inbound TCP
connections to the default SSH port 22 , and for a Windows host rules will be added allowing inbound
connections to the default SSH port 22 , and for a Windows host rules will be added allowing inbound
access to RDP ports 3389 and 5986. Override the default ports by providing a list of open ports .
access to RDP ports 3389 and 5986. Override the default ports by providing a list of open ports .
enable_ip_forwarding :
description :
- Whether to enable IP forwarding
aliases :
- ip_forwarding
type : bool
default : False
version_added : 2.7
extends_documentation_fragment :
extends_documentation_fragment :
- azure
- azure
- azure_tags
- azure_tags
@ -271,6 +279,18 @@ EXAMPLES = '''
subnet_name : subnet001
subnet_name : subnet001
enable_accelerated_networking : True
enable_accelerated_networking : True
- name : Create a network interface with IP forwarding
azure_rm_networkinterface :
name : nic001
resource_group : Testing
virtual_network : vnet001
subnet_name : subnet001
ip_forwarding : True
ip_configurations :
- name : ipconfig1
public_ip_address_name : publicip001
primary : True
- name : Delete network interface
- name : Delete network interface
azure_rm_networkinterface :
azure_rm_networkinterface :
resource_group : Testing
resource_group : Testing
@ -415,6 +435,7 @@ class AzureRMNetworkInterface(AzureRMModuleBase):
ip_configurations = dict ( type = ' list ' , default = None , elements = ' dict ' , options = ip_configuration_spec ) ,
ip_configurations = dict ( type = ' list ' , default = None , elements = ' dict ' , options = ip_configuration_spec ) ,
os_type = dict ( type = ' str ' , choices = [ ' Windows ' , ' Linux ' ] , default = ' Linux ' ) ,
os_type = dict ( type = ' str ' , choices = [ ' Windows ' , ' Linux ' ] , default = ' Linux ' ) ,
open_ports = dict ( type = ' list ' ) ,
open_ports = dict ( type = ' list ' ) ,
enable_ip_forwarding = dict ( type = ' bool ' , aliases = [ ' ip_forwarding ' ] , default = False ) ,
)
)
required_if = [
required_if = [
@ -438,6 +459,7 @@ class AzureRMNetworkInterface(AzureRMModuleBase):
self . tags = None
self . tags = None
self . os_type = None
self . os_type = None
self . open_ports = None
self . open_ports = None
self . enable_ip_forwarding = None
self . ip_configurations = None
self . ip_configurations = None
self . results = dict (
self . results = dict (
@ -512,6 +534,12 @@ class AzureRMNetworkInterface(AzureRMModuleBase):
results . get ( ' enable_accelerated_networking ' ) ) )
results . get ( ' enable_accelerated_networking ' ) ) )
changed = True
changed = True
if self . enable_ip_forwarding != bool ( results . get ( ' enable_ip_forwarding ' ) ) :
self . log ( " CHANGED: IP forwarding set to {0} (previously {1} ) " . format (
self . enable_ip_forwarding ,
results . get ( ' enable_ip_forwarding ' ) ) )
changed = True
if not changed :
if not changed :
nsg = self . get_security_group ( self . security_group [ ' resource_group ' ] , self . security_group [ ' name ' ] )
nsg = self . get_security_group ( self . security_group [ ' resource_group ' ] , self . security_group [ ' name ' ] )
if nsg and results . get ( ' network_security_group ' ) and results [ ' network_security_group ' ] . get ( ' id ' ) != nsg . id :
if nsg and results . get ( ' network_security_group ' ) and results [ ' network_security_group ' ] . get ( ' id ' ) != nsg . id :
@ -591,6 +619,7 @@ class AzureRMNetworkInterface(AzureRMModuleBase):
tags = self . tags ,
tags = self . tags ,
ip_configurations = nic_ip_configurations ,
ip_configurations = nic_ip_configurations ,
enable_accelerated_networking = self . enable_accelerated_networking ,
enable_accelerated_networking = self . enable_accelerated_networking ,
enable_ip_forwarding = self . enable_ip_forwarding ,
network_security_group = nsg
network_security_group = nsg
)
)
self . results [ ' state ' ] = self . create_or_update_nic ( nic )
self . results [ ' state ' ] = self . create_or_update_nic ( nic )