EagleBeak
EagleBeak

Reputation: 7419

Re-associate AWS Elastic IP with Ansible

I use Ansible for spinning up EC2 instances and deploying services to them. I would like to re-associate an elastic IP which is already associated with an existing EC2 instance to a new instance with as little down time as possible. Do I get it right that this only works in two steps with the Ansible ec2_eip module?

There is no way to do it in one step as with the allow-reassociation option of the ec2-associate-address CLI command, right?

Upvotes: 1

Views: 521

Answers (1)

Eric Citaire
Eric Citaire

Reputation: 4513

I just made a pull request which might help you.

This PR is adding 2 modules : boto3 and boto3_wait. It allows you to call any Boto 3 client operation.

You could use it like so :

- name: Re-associate Elastic IP
  boto3:
    name: ec2
    region: us-east-1
    operation: associate_address
    parameters:
      AllowReassociation: yes
      InstanceId: i-xxxxxxxxxxxxxxxxx
      AllocationId: eipalloc-xxxxxxxx

If you're interrested by this feature, feel free to vote up on the PR. :)

Upvotes: 1

Related Questions