azure.azcollection.azure_rm_networkinterface – Manage Azure network interfaces¶
Note
This plugin is part of the azure.azcollection collection (version 1.5.0).
To install it use: ansible-galaxy collection install azure.azcollection
.
To use it in a playbook, specify: azure.azcollection.azure_rm_networkinterface
.
New in version 0.1.0: of azure.azcollection
Synopsis¶
Create, update or delete a network interface.
When creating a network interface you must provide the name of an existing virtual network, the name of an existing subnet within the virtual network.
A default security group and public IP address will be created automatically.
Or you can provide the name of an existing security group and public IP address.
See the examples below for more details.
Requirements¶
The below requirements are needed on the host that executes this module.
python >= 2.7
azure >= 2.0.0
Parameters¶
Notes¶
Note
For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with
az login
.Authentication is also possible using a service principal or Active Directory user.
To authenticate via service principal, pass subscription_id, client_id, secret and tenant or set environment variables AZURE_SUBSCRIPTION_ID, AZURE_CLIENT_ID, AZURE_SECRET and AZURE_TENANT.
To authenticate via Active Directory user, pass ad_user and password, or set AZURE_AD_USER and AZURE_PASSWORD in the environment.
Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription_id, client_id, secret and tenant or subscription_id, ad_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE_PROFILE in the environment.
See Also¶
See also
- Sign in with Azure CLI
How to authenticate using the
az login
command.
Examples¶
- name: Create a network interface with minimal parameters
azure_rm_networkinterface:
name: nic001
resource_group: myResourceGroup
virtual_network: vnet001
subnet_name: subnet001
ip_configurations:
- name: ipconfig1
public_ip_address_name: publicip001
primary: True
- name: Create a network interface with private IP address only (no Public IP)
azure_rm_networkinterface:
name: nic001
resource_group: myResourceGroup
virtual_network: vnet001
subnet_name: subnet001
create_with_security_group: False
ip_configurations:
- name: ipconfig1
primary: True
- name: Create a network interface for use in a Windows host (opens RDP port) with custom RDP port
azure_rm_networkinterface:
name: nic002
resource_group: myResourceGroup
virtual_network: vnet001
subnet_name: subnet001
os_type: Windows
rdp_port: 3399
security_group: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkSecurit
yGroups/nsg001"
ip_configurations:
- name: ipconfig1
public_ip_address_name: publicip001
primary: True
- name: Create a network interface using existing security group and public IP
azure_rm_networkinterface:
name: nic003
resource_group: myResourceGroup
virtual_network: vnet001
subnet_name: subnet001
security_group: secgroup001
ip_configurations:
- name: ipconfig1
public_ip_address_name: publicip001
primary: True
- name: Create a network with multiple ip configurations
azure_rm_networkinterface:
name: nic004
resource_group: myResourceGroup
subnet_name: subnet001
virtual_network: vnet001
security_group:
name: testnic002
resource_group: Testing1
ip_configurations:
- name: ipconfig1
public_ip_address_name: publicip001
primary: True
- name: ipconfig2
load_balancer_backend_address_pools:
- "{{ loadbalancer001.state.backend_address_pools[0].id }}"
- name: backendaddrpool1
load_balancer: loadbalancer001
- name: Create a network interface in accelerated networking mode
azure_rm_networkinterface:
name: nic005
resource_group: myResourceGroup
virtual_network_name: vnet001
subnet_name: subnet001
enable_accelerated_networking: True
- name: Create a network interface with IP forwarding
azure_rm_networkinterface:
name: nic001
resource_group: myResourceGroup
virtual_network: vnet001
subnet_name: subnet001
ip_forwarding: True
ip_configurations:
- name: ipconfig1
public_ip_address_name: publicip001
primary: True
- name: Create a network interface with dns servers
azure_rm_networkinterface:
name: nic009
resource_group: myResourceGroup
virtual_network: vnet001
subnet_name: subnet001
dns_servers:
- 8.8.8.8
- name: Delete network interface
azure_rm_networkinterface:
resource_group: myResourceGroup
name: nic003
state: absent
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Authors¶
Chris Houseknecht (@chouseknecht)
Matt Davis (@nitzmahone)
Yuwei Zhou (@yuwzho)