I am trying to assign a single elastic IP to a single AWS instance using 
this:

  - name: associate an assigned IP with a running instance
    ec2_eip:
      region: "{{ aws_region }}"
      ip: "{{ eip.public_ip }}"
      device_id: "{{ ec2.instance_ids }}"
    register: eip

This is what I am getting back for a response:

fatal: [localhost]: FAILED! => {
    "changed": false,
    "failed": true,
    "invocation": {
        "module_args": {
            "aws_access_key": null,
            "aws_secret_key": null,
            "device_id": "['i-077050831eb30d9da']",
            "ec2_url": null,
            "in_vpc": false,
            "ip": "34.195.37.120",
            "profile": null,
            "public_ip": "34.195.37.120",
            "region": "us-east-1",
            "release_on_disassociation": false,
            "reuse_existing_ip_allowed": false,
            "security_token": null,
            "state": "present",
            "validate_certs": true,
            "wait_timeout": "300"
        },
        "module_name": "ec2_eip"
    },
    "msg": "EC2ResponseError: 400 Bad Request\n<?xml version=\"1.0\" 
encoding=\"UTF-8\"?>\n<Response><Errors><Error><Code>InvalidNetworkInterfaceId.Malformed</Code><Message>Invalid
 
id: \"['i-077050831eb30d9da']\" (expecting 
\"eni-...\")</Message></Error></Errors><RequestID>d13bc6c2-ee3a-48ed-8e64-a84caea7bbfc</RequestID></Response>"
}

The error coming back from AWS seems to indicate device_id is expecting a 
eni, but the docs clearly say that device_id can be an EC2 instance ID:

http://docs.ansible.com/ansible/ec2_eip_module.html#options

What am I doing wrong? Do I have to somehow token-ize the ec2_instance_ids?

Thanks!

-- 
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/e3abedd9-36c6-426f-8144-0026a3ce2326%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to