New in version 2.8.0.
The below requirements are needed on the host that executes this module.
| Parameter | Choices/Defaults | Comments |
|---|---|---|
| alicloud_access_key |
Aliyun Cloud access key. If not set then the value of environment variable
ALICLOUD_ACCESS_KEY, ALICLOUD_ACCESS_KEY_ID will be used instead.aliases: access_key_id, access_key |
|
| alicloud_region |
The Aliyun Cloud region to use. If not specified then the value of environment variable
ALICLOUD_REGION, ALICLOUD_REGION_ID will be used instead.aliases: region, region_id |
|
| alicloud_secret_key |
Aliyun Cloud secret key. If not set then the value of environment variable
ALICLOUD_SECRET_KEY, ALICLOUD_SECRET_ACCESS_KEY will be used instead.aliases: secret_access_key, secret_key |
|
| alicloud_security_token |
The Aliyun Cloud security token. If not specified then the value of environment variable
ALICLOUD_SECURITY_TOKEN will be used instead.aliases: security_token |
|
|
attached
bool |
|
Specifies if network interface should be attached or detached from instance. If ommited, attachment status won't change
|
| description |
Optional description of the ENI.
|
|
| eni_id |
The ID of the ENI (to modify); if null and state is present, a new eni will be created.
aliases: id |
|
| instance_id |
Instance ID that you wish to attach ENI to.
|
|
| name |
Optional name of the ENI. It is a string of [2, 128] Chinese or English characters. It must begin with a letter and can contain numbers, underscores ("_"), colons (":"), or hyphens ("-"). It cannot begin with http:// or https://.
|
|
| private_ip_address |
Private IP address. If null and state is present, a vacant IP address will be allocated.
aliases: private_ip |
|
|
purge_tags
bool |
|
Delete existing tags on the network interface that are not specified in the task. If True, it means you have to specify all the desired tags on each task affecting a network interface.
|
| security_groups |
List of security group ids associated with the interface.
|
|
| state |
|
Create or delete ENI.
|
| tags |
A hash/dictionaries of network interface tags.
{"key":"value"} |
|
| vswitch_id |
ID of subnet in which to create the ENI.
aliases: subnet_id |
Note
ALICLOUD_ACCESS_KEY or ALICLOUD_ACCESS_KEY_ID, ALICLOUD_SECRET_KEY or ALICLOUD_SECRET_ACCESS_KEY, ALICLOUD_REGION or ALICLOUD_REGION_ID, ALICLOUD_SECURITY_TOKENALICLOUD_REGION or ALICLOUD_REGION_ID can be typically be used to specify the ALICLOUD region, when required, but this can also be configured in the footmark config file# Note: These examples do not set authentication details, see the Alibaba Cloud Guide for details.
# Create an ENI.
- ali_eni:
private_ip_address: 172.31.0.20
vswitch_id: vsw-xxxxxxxx
security_groups:
- sg-xxxxxx1
- sg-xxxxxx2
state: present
# Create an ENI and attach it to an instance
- ali_eni:
instance_id: i-xxxxxxx
private_ip_address: 172.31.0.20
vswitch_id: vsw-xxxxxxxx
security_groups:
- sg-xxxxxx1
- sg-xxxxxx2
attached: True
# Update an ENI
- ali_eni:
eni_id: eni-xxxxxxx
name: my-eni
description: "My new description"
# Update an ENI identifying it by private_ip_address and subnet_id
- ali_eni:
vswitch_id: vsw-xxxxxxx
private_ip_address: 172.16.1.1
description: "My new description"
security_groups:
- sg-xxxxxx3
- sg-xxxxxx4
# Detach an ENI from an instance
- ali_eni:
eni_id: eni-xxxxxxx
instance_id: i-xxxxxx
attached: False
state: present
# Delete an interface
# First create the interface
- ali_eni:
vswitch_id: vsw-xxxxxxxx
security_groups:
- sg-xxxxxx1
- sg-xxxxxx2
state: present
register: eni
- ali_eni:
eni_id: "{{ eni.interface.id }}"
state: absent
Common return values are documented here, the following are the fields unique to this module:
| Key | Returned | Description | |
|---|---|---|---|
|
interface
complex
|
always |
info about the elastic network interfaces that was created or deleted.
|
|
|
description
string
|
interface description
Sample:
My new network interface
|
||
|
tags
dict
|
always |
Any tags assigned to the ENI.
|
|
|
creation_time
string
|
always |
The time the eni was created.
Sample:
2018-06-25T04:08Z
|
|
|
associated_public_ip
string
|
The public IP address associated with the ENI.
Sample:
42.1.10.1
|
||
|
id
string
|
network interface id (alias for network_interface_id)
Sample:
eni-123456
|
||
|
security_groups
list
|
list of security group ids
Sample:
['sg-f8a8a9da', 'sg-xxxxxx']
|
||
|
zone_id
string
|
always |
The availability zone of the ENI is in.
Sample:
cn-beijing-a
|
|
|
name
string
|
interface name
Sample:
my-eni
|
||
|
vswitch_id
string
|
which vswitch the interface is bound
Sample:
vsw-b33i43f3
|
||
|
network_interface_id
string
|
network interface id
Sample:
eni-123456
|
||
|
instance_id
string
|
Attached instance id
Sample:
i-123456
|
||
|
state
string
|
network interface status
Sample:
pending
|
||
|
private_ip_addresses
list of dictionaries
|
list of all private ip addresses associated to this interface
Sample:
[{'private_ip_address': '10.20.30.40', 'primary_address': True}]
|
||
|
mac_address
string
|
interface's physical address
Sample:
00:00:5E:00:53:23
|
||
|
private_ip_address
string
|
primary ip address of this interface
Sample:
10.20.30.40
|
||
|
vpc_id
string
|
which vpc this network interface is bound
Sample:
vpc-cj3ht4ogn
|
||
|
type
string
|
type of the ENI
Sample:
Secondary
|
||
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
Hint
If you notice any issues in this documentation you can edit this document to improve it.