New in version 2.8.
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 |
|
|
allow_reassociation
bool |
|
Specify this option to allow an Elastic IP address that is already associated with another ECS or SLB Instance to be re-associated with the specified instance.
|
| bandwidth |
Default: 5
|
Maximum outgoing bandwidth to the EIP, measured in Mbps (Mega bit per second)
|
| description |
The description of the EIP. The description can contain from 2 to 256 characters. The description must start with English letters, but cannot start with http:// or https://.
|
|
| instance_id |
The id of the device for the EIP. Can be an ECS instance id or SLB Instance id or Elastic Network Interface (ENI) id.
aliases: device_id |
|
| internet_charge_type |
|
Internet charge type of ECS instance
|
| ip_address |
The IP address of a previously allocated EIP and it can used to associate/disassociate with a device or delete itself.
If present and instance_id is specified, the EIP is associated with the instance.
If absent and instance_id is specified, the EIP is disassociated from the instance.
aliases: ip |
|
| name |
The name of the EIP. The name can contain from 2 to 128 characters including "a-z", "A-Z", "0-9", underlines, and hyphens. The name must start with an English letter, but cannot start with http:// or https://.
|
|
|
release_on_disassociation
bool |
|
whether or not to automatically release the EIP when it is disassociated
|
|
reuse_existing_ip_allowed
bool |
|
Reuse an EIP that is not associated to a instance (when available), instead of allocating a new one.
|
| state |
|
state for operating elastic IP address
|
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.
- name: associate an elastic IP with an instance
ali_eip:
instance_id: i-cqhc3hf4
- name: associate an elastic IP with a device
ali_eip:
instance_id: eni-snc3nh438t
- name: associate an elastic IP with a instance and allow reassociation
ali_eip:
instance_id: i-cqhc3hf4
allow_reassociation: True
- name: disassociate an elastic IP from an instance
ali_eip:
instance_id: i-cqhc3hf4
ip: 93.184.216.119
state: absent
- name: disassociate an elastic IP with a device
ali_eip:
instance_id: eni-snc3nh438t
ip: 93.184.216.119
state: absent
- name: allocate a new elastic IP and associate it with an instance
ali_eip:
instance_id: i-1212f003
- name: allocate a new elastic IP without associating it to anything and set name and description
ali_eip:
name: created-by-ansible
description: "form ansible"
register: eip
- name: output the IP
debug:
msg: "Allocated IP is {{ eip.public_ip }}"
Common return values are documented here, the following are the fields unique to this module:
| Key | Returned | Description | |
|---|---|---|---|
|
eip
complex
|
always |
info about the elastic IP address that was created or deleted.
|
|
|
charge_type
string
|
always |
The eip charge type.
Sample:
PostPaid
|
|
|
allocation_time
string
|
always |
The time the EIP was created
Sample:
2018-12-31T12:12:52Z
|
|
|
description
string
|
always |
interface description
Sample:
My new EIP
|
|
|
allocation_id
string
|
always |
The EIP id
Sample:
eip-2zee1nu68juox4
|
|
|
internet_charge_type
string
|
always |
The EIP charge type.
Sample:
PayByTraffic
|
|
|
tags
dict
|
always |
Any tags assigned to the EIP.
|
|
|
instance_id
string
|
always |
Associated instance id
Sample:
i-123456
|
|
|
instance_type
string
|
always |
Associated instance type
Sample:
EcsInstance
|
|
|
bandwidth
int
|
always |
Maximum bandwidth from the internet network
Sample:
5
|
|
|
status
string
|
always |
The EIP status
Sample:
inuse
|
|
|
instance_region_id
string
|
always |
The region id in which the associated instance
Sample:
cn-beijing
|
|
|
ip_address
string
|
always |
The IP address of the EIP
Sample:
39.96.169.143
|
|
|
id
string
|
always |
Allocated EIP id (alias for allocation_id)
Sample:
eip-2zee1nu68juox4
|
|
|
name
string
|
always |
The EIP name
Sample:
from-ansible
|
|
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.