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

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3d32bc52-646c-4e46-9511-f33ab2331e16%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to