-
Bug
-
Resolution: Unresolved
-
Undefined
-
None
-
Unspecified
-
False
-
-
False
-
-
https://github.com/ansible-collections/amazon.aws/issues/2218
-
-
- Summary
-
I have multiple secondary IPs on multiple ENIs, and I'm trying to allocate and then associate EIPs to all IPs (primary and secondary) on each ENI - up to the limit the instance allows. I am using t4g.small which allows 2 interfaces with 4 IPs per interface (ref: https://docs.aws.amazon.com/ec2/latest/instancetypes/gp.html).
What I see happening is with a list of 6 items, only 2 EIPs are ever allocated and they are associated with the primary IP on each ENI. When I check the tags on the 2 EIPs that are created, I see the "ip" tag has a value that does not match the private_ip_address it has been associated with - so it looks like the loop is overwriting tags and for some reason not allocating a new EIP.
-
-
- Issue Type
-
Bug Report
-
-
- Component Name
-
amazon.aws.ec2_eip
-
-
- Ansible Version
-
```console (paste below)
$ ansible --version
ansible [core 2.15.12]
python version = 3.12.4
jinja version = 3.1.4
```
-
-
- Collection Versions
-
```console (paste below)
$ ansible-galaxy collection list
amazon.aws 8.1.0
```
-
-
- AWS SDK versions
-
```console (paste below)
$ pip show boto boto3 botocore
WARNING: Package(s) not found: boto
Name: boto3
Version: 1.34.131
—
Name: botocore
Version: 1.34.131
```
-
-
- Configuration
-
```console (paste below)
$ ansible-config dump --only-changed
```
-
-
- OS / Environment
-
Fedora 40
-
-
- Steps to Reproduce
-
With `eni_info` being:
```
[
,
,
,
,
,
{ "eni": "eni-0fb509662f6d64604", "ip": "192.168.130.68" }]
```
the below task returns changed for all items, but only 2 EIPs are ever allocated, and they are associated with the primary IP of each ENI. When I check the tags on the 2 EIPs they do not match the private_ip_address they are associated with.
<!--- Paste example playbooks or commands between quotes below -->
```yaml (paste below)
- name: Associate EIP
become: no
delegate_to: localhost
amazon.aws.ec2_eip:
device_id: "{{ item.eni }}"
private_ip_address: "{{ item.ip }}"
in_vpc: true
tags:
eni: "{{ item.eni }}"
ip: "{{ item.ip }}"
loop: "{{ eni_info }}"
```
-
-
- Expected Results
-
I expect 6 EIPs to be allocated and associated with primary and secondary private IP addresse. This can be achieved when done manually in the AWS console.
-
-
- Actual Results
-
```console (paste below)
TASK [eip : Associate EIP] *******************************************************************************************************************************************************************************************************************
changed: [myhost -> localhost] => (item=
)
changed: [myhost -> localhost] => (item=
)
changed: [myhost-> localhost] => (item=
)
changed: [myhost -> localhost] => (item=
)
changed: [myhost-> localhost] => (item=
)
changed: [myhost -> localhost] => (item=
)
```
Evidence of only 2 EIPs being created and associated (note the difference in tag IP and the IP assoicated):
```
$ aws ec2 describe-addresses --filters "Name=tag-key,Values=ip"
{
"Addresses": [
{
"InstanceId": "i-01a82021739b0d47d",
"PublicIp": "3.127.161.240",
"AllocationId": "eipalloc-00a0505ca83eb7ab2",
"AssociationId": "eipassoc-0d5b78915e99deba0",
"Domain": "vpc",
"NetworkInterfaceId": "eni-02e27f806845a09de",
"NetworkInterfaceOwnerId": "546442592561",
"PrivateIpAddress": "192.168.142.188",
"Tags": [
,
{ "Key": "eni", "Value": "eni-02e27f806845a09de" } ],
"PublicIpv4Pool": "amazon",
"NetworkBorderGroup": "eu-central-1"
},
{
"InstanceId": "i-01a82021739b0d47d",
"PublicIp": "3.74.1.24",
"AllocationId": "eipalloc-0178711a6fd1d4416",
"AssociationId": "eipassoc-023fd29137ed53faa",
"Domain": "vpc",
"NetworkInterfaceId": "eni-0fb509662f6d64604",
"NetworkInterfaceOwnerId": "546442592561",
"PrivateIpAddress": "192.168.131.230",
"Tags": [
,
{ "Key": "ip", "Value": "192.168.130.68" } ],
"PublicIpv4Pool": "amazon",
"NetworkBorderGroup": "eu-central-1"
}
]
}
```
-
-
- Code of Conduct
-
- [X] I agree to follow the Ansible Code of Conduct