Documentation

alicloud_eip - Create eip address and bind it to ECS or SLB instance.

DEPRECATED

Removed in Ansible:
 version: 1.5.0
Why:Alibaba Cloud module name prefix ‘ali’ will be more concise
Alternative:Use ali_eip instead

Synopsis

  • Create and release an elastic IP address Associate/disassociate an EIP with ECS or SLB instance

Requirements

The below requirements are needed on the host that executes this module.

  • footmark >= 1.1.16
  • python >= 2.6

Parameters

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
bandwidth Default:
5
Maximum outgoing bandwidth to the EIP, measured in Mbps (Mega bit per second)
instance_id
The id of the device for the EIP. Can be an ECS or SLB Instance id

aliases: device_id
internet_charge_type
    Choices:
  • PayByBandwidth ←
  • PayByTraffic
Internet charge type of ECS instance
ip_address
The IP address of a previously created EIP. A new EIP will be allocated if it is not specified.
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
state
    Choices:
  • present ←
  • absent
state for operating elastic IP address

Notes

Note

  • If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence ALICLOUD_ACCESS_KEY or ALICLOUD_ACCESS_KEY_ID, ALICLOUD_SECRET_KEY or ALICLOUD_SECRET_ACCESS_KEY, ALICLOUD_REGION or ALICLOUD_REGION_ID, ALICLOUD_SECURITY_TOKEN
  • ALICLOUD_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

Examples

# provide some examples to manage eip addresses
- name: requesting eip
  hosts: localhost
  connection: local
  vars:
    alicloud_access_key: <your-alicloud-access-key-id>
    alicloud_secret_key: <your-alicloud-access-secret-key>
    alicloud_region: cn-hongkong
    internet_charge_type: PayByTraffic
    bandwidth: 5
    instance_id: i-23dsefwfv332
  tasks:
    - name: allocating an eip
      alicloud_eip:
        alicloud_access_key: '{{ alicloud_access_key }}'
        alicloud_secret_key: '{{ alicloud_secret_key }}'
        alicloud_region: '{{ alicloud_region }}'
        internet_charge_type: '{{ internet_charge_type }}'
        bandwidth: '{{ bandwidth }}'
        state: present
      register: new_eip

    - name: associate the created EIP with an ECS instance
      alicloud_eip:
        alicloud_access_key: '{{ alicloud_access_key }}'
        alicloud_secret_key: '{{ alicloud_secret_key }}'
        alicloud_region: '{{ alicloud_region }}'
        ip_address: '{{ new_eip.ip_address }}'
        instance_id: '{{ instance_id }}'
        state: present

    - name: disassociate the created EIP with an ECS instance
      alicloud_eip:
        alicloud_access_key: '{{ alicloud_access_key }}'
        alicloud_secret_key: '{{ alicloud_secret_key }}'
        alicloud_region: '{{ alicloud_region }}'
        ip_address: '{{ new_eip.ip_address }}'
        instance_id: '{{ instance_id }}'
        state: absent

    - name: disassociate the created EIP with an ECS instance
      alicloud_eip:
        alicloud_access_key: '{{ alicloud_access_key }}'
        alicloud_secret_key: '{{ alicloud_secret_key }}'
        alicloud_region: '{{ alicloud_region }}'
        ip_address: '{{ new_eip.ip_address }}'
        state: absent

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
allocation_id
string
when present
ID of the allocated EIP

Sample:
eip-25877c70x
eip
dict
when present
Details about the allocated EIP

Sample:
{'charge_type': 'PostPaid', 'allocation_time': '2017-11-13T06:32:50Z', 'internet_charge_type': 'PayByTraffic', 'operation_locks': {'lock_reason': []}, 'instance_id': '', 'instance_type': '', 'bandwidth': '7', 'status': 'Available', 'ip_address': '47.91.89.172', 'id': 'eip-gw8wkbxtnl3mh2orfpwm6', 'region_id': 'eu-central-1'}
instance_id
string
when present
ID of the associated device

Sample:
i-aex25877c70x
ip_address
string
when present
IP address of the allocated EIP

Sample:
123.56.0.206


Status

This module is flagged as deprecated and will be removed in version 1.5.0. For more information see DEPRECATED.

Author

  • He Guimin (@xiaozhu36)

Hint

If you notice any issues in this documentation you can edit this document to improve it.