ansible/ansible — pull request #5663 by juise (2014-01-17 11:49:32+00:00)
Title: Add dns name support to ec2

Hello!

I would like to add dns_name feature to ec2 module.

For creation instances, dns_name parameter will work like id parameter, but in more convenient way. If instance with target dns_name exists, then the new instance with the same dns_name will not be created.

For termination instances, dns_name parameter will work like instance_ids parameter.

create:
- name: Launch instance
local_action: ec2
dns_name={{ item.dns_name }}
group={{ item.group }}
...
aws_secret_key={{ aws_secret_key }}
wait=true
register: ec2

terminate:
tasks:
- name: Terminate instance
local_action: ec2
dns_name={{ item.dns_name }}
...
aws_secret_key={{ aws_secret_key }}
state='absent'
with_items:
- dns_name: ec2-184-169-125-4.us-west-1.compute.amazonaws.com
- dns_name: ec2-158-120-200-124.us-west-1.compute.amazonaws.com