# How to assing ipv6 address(es) using ec2\_instance module?

**URL:** <https://forum.ansible.com/t/how-to-assing-ipv6-address-es-using-ec2-instance-module/29493>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [January 22, 2019, 2:47pm UTC](https://forum.ansible.com/t/how-to-assing-ipv6-address-es-using-ec2-instance-module/29493 "2019-01-22T14:47:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jp12](https://avatars.discourse-cdn.com/v4/letter/j/e47c2d/32.png) [@jp12](https://forum.ansible.com/u/jp12)\
**Post date:** [January 22, 2019, 2:47pm UTC](https://forum.ansible.com/t/how-to-assing-ipv6-address-es-using-ec2-instance-module/29493/1 "2019-01-22T14:47:27Z")

</div>

I am trying to define new ipv6 address for ENI using ec2\_instance module in ansible 2.7.6- I just don’t get it how to define the task? output is just “changed: false” and nothing happens. Would anyone be able to point out how to add new and remove extra ipv6 addresses from running ec2 instance?

I have tried many versions nothing seems to work so currently I just use local action for aws which is nothing else than work around.

- name: eni fact gather  
ec2\_eni\_facts:  
filters:  
private-ip-address: “{{instance\_launch.tagged\_instances[0].private\_ip}}”  
register: eni\_facts

- name: Create lists  
set\_fact:  
ipv6\_address\_list: “”

- name: Append list ipv6\_address\_list  
set\_fact:  
ipv6\_address\_list: “{{ipv6\_address\_list}} + [‘{{item.ipv6\_address}}’]”  
with\_items:

- “{{eni\_facts.network\_interfaces[0].ipv6\_addresses}}”

- name: Add new ipv6 addresses using awscli local action  
local\_action: command aws ec2 assign-ipv6-addresses --network-interface-id {{eni\_facts.network\_interfaces[0].id}} --ipv6-addresses {{item}}  
when: item not in ipv6\_address\_list  
with\_items:

- “2a05:d018:c25:1701::11”

# Not working. why?

#- name: Assign ipv6 to EC2 network interface

# ec2\_instance:

# state: present

# region: “{{amazon\_region}}”

# vpc\_subnet\_id: “{{vpcdata\_subnets.results[1].subnet.id}}”

# instance\_ids:

# - “{{instance\_launch.tagged\_instances[0].id}}”

# network:

# interfaces:

# - “{{eni\_facts.network\_interfaces[0].id}}”

# ipv6\_addresses:

# - 2a05:d018:c25:1701::11
