0

I'm trying to assign an EIP to an ec2 instance using the guide for the aws_eip module. However for some reason the aws_eip module has some issue with device_id. I am using ansible 1.9.4:

TASK: [associate an elastic IP with an instance] ****************************** 
failed: [localhost] => {"failed": true}
msg: unsupported parameter for module: device_id

FATAL: all hosts have already failed -- aborting

I assume it wants me to use something other than device_id. What should I use?

Alex Cohen
  • 5,596
  • 16
  • 54
  • 104

1 Answers1

0

Apparently the examples in the doc are wrong. You should use instance_id instead of device_ip. This is what your task should look like (note that "{{ ec2['tagged_instances'][0]['id'] }}" is the ansible variable that stores the instance id):

- name: associate an elastic IP with an instance
  ec2_eip:
    region: 'us-west-2'
    instance_id: "{{ ec2['tagged_instances'][0]['id'] }}"
    ip: "{{ elastic_ip }}"
Alex Cohen
  • 5,596
  • 16
  • 54
  • 104
  • 1
    There is a note about version support for each module's parameter. And for `device_id` it is `version_added: "2.0"`. Consider upgrading your Ansible version. – Konstantin Suvorov Nov 08 '16 at 06:54