azure.azcollection.azure_rm_networkinterface_info module – Get network interface facts
Note
This module is part of the azure.azcollection collection (version 1.13.0).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install azure.azcollection
.
To use it in a playbook, specify: azure.azcollection.azure_rm_networkinterface_info
.
New in version 0.1.2: of azure.azcollection
Synopsis
Get facts for a specific network interface or all network interfaces within a resource group.
Requirements
The below requirements are needed on the host that executes this module.
python >= 2.7
The host that executes this module must have the azure.azcollection collection installed via galaxy
All python packages listed in collection’s requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection
Full installation instructions may be found https://galaxy.ansible.com/azure/azcollection
Parameters
Parameter |
Comments |
---|---|
Active Directory username. Use when authenticating with an Active Directory user rather than service principal. |
|
Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. |
|
Selects an API profile to use when communicating with Azure services. Default value of Default: “latest” |
|
Controls the source of the credentials to use for authentication. Can also be set via the When set to When set to When set to When set to When set to The Choices:
|
|
Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing Choices:
|
|
Azure client ID. Use when authenticating with a Service Principal. |
|
For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, Default: “AzureCloud” |
|
Parent argument. |
|
Parent argument. |
|
Only show results for a specific network interface. |
|
Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. |
|
Security profile found in ~/.azure/credentials file. |
|
Name of the resource group containing the network interface(s). Required when searching by name. |
|
Azure client secret. Use when authenticating with a Service Principal. |
|
Your Azure subscription Id. |
|
Limit results by providing a list of tags. Format tags as ‘key’ or ‘key:value’. |
|
Azure tenant ID. Use when authenticating with a Service Principal. |
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: Get facts for one network interface
azure_rm_networkinterface_info:
resource_group: myResourceGroup
name: nic001
- name: Get network interfaces within a resource group
azure_rm_networkinterface_info:
resource_group: myResourceGroup
- name: Get network interfaces by tag
azure_rm_networkinterface_info:
resource_group: myResourceGroup
tags:
- testing
- foo:bar
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
List of network interface dicts. Returned: always Sample: [{“dns_settings”: {“applied_dns_servers”: [], “dns_servers”: [], “internal_dns_name_label”: null, “internal_fqdn”: null}, “enable_ip_forwarding”: false, “etag”: “W/\”59726bfc-08c4-44ed-b900-f6a559876a9d\””, “id”: “/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nic003”, “ip_configuration”: {“name”: “default”, “private_ip_address”: “10.10.0.4”, “private_ip_allocation_method”: “Dynamic”, “public_ip_address”: {“id”: “/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/publicIPAddresses/publicip001”, “name”: “publicip001”}, “subnet”: {“id”: “/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet001/subnets/subnet001”, “name”: “subnet001”, “virtual_network_name”: “vnet001”}}, “location”: “westus”, “mac_address”: null, “name”: “nic003”, “network_security_group”: {“id”: “/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/secgroup001”, “name”: “secgroup001”}, “primary”: null, “provisioning_state”: “Succeeded”, “tags”: {}, “type”: “Microsoft.Network/networkInterfaces”}] |
|
List of network interface dicts. Each dict contains parameters can be passed to azure.azcollection.azure_rm_networkinterface module. Returned: always |
|
Specifies whether a default security group should be be created with the NIC. Only applies when creating a new NIC. Returned: success |
|
Which DNS servers should the NIC lookup. List of IP addresses. Returned: success |
|
The DNS settings in network interface. Returned: success |
|
If the VM that uses this NIC is part of an Availability Set, then this list will have the union of all DNS servers from all NICs that are part of the Availability Set. This property is what is configured on each of those VMs. Returned: success |
|
List of DNS servers IP addresses. Returned: success |
|
Relative DNS name for this NIC used for internal communications between VMs in the same virtual network. Returned: success |
|
Fully qualified DNS name supporting internal communications between VMs in the same virtual network. Returned: success |
|
Specifies whether the network interface should be created with the accelerated networking feature or not. Returned: success |
|
Whether to enable IP forwarding Returned: success |
|
Id of the network interface. Returned: success |
|
List of IP configurations, if contains multiple configurations. Returned: success |
|
List of existing application gateway backend address pools associated with the network interface. Returned: success |
|
List of Application security groups. Returned: success Sample: “/subscriptions/\u003csubsid\u003e/resourceGroups/\u003crg\u003e/providers/Microsoft.Network/applicationSecurityGroups/myASG” |
|
List of existing load-balancer backend address pools associated with the network interface. Returned: success |
|
Name of the IP configuration. Returned: success |
|
Whether the IP configuration is the primary one in the list. Returned: success |
|
Private IP address for the IP configuration. Returned: success |
|
Private IP allocation method. Returned: success |
|
Name of the public IP address. None for disable IP address. Returned: success |
|
Public IP allocation method. Returned: success |
|
Azure location. Returned: success |
|
The MAC address of the network interface. Returned: success |
|
Name of the network interface. Returned: success |
|
The provisioning state of the network interface. Returned: success |
|
Name of a resource group where the network interface exists. Returned: success |
|
A security group resource ID with which to associate the network interface. Returned: success |
|
Name of an existing subnet within the specified virtual network. Returned: success |
|
Tags of the network interface. Returned: success |
|
An existing virtual network with which the network interface will be associated. It is a dict which contains name and resource_group of the virtual network. Returned: success |
Authors
Chris Houseknecht (@chouseknecht)
Matt Davis (@nitzmahone)