I'm using exact_count when creating an instance on EC2, when the instance already exists the next action fails with the following error:
- name: Provision EC2 SC instances
local_action:
module: ec2
region: "{{ aws_region }}"
keypair: "{{ aws_keypair }}"
group: ansibleDefault
instance_type: "{{ aws_instanceType }}"
image: "{{ aws_image }}"
exact_count: 1
count_tag:
Class: "websever"
vpc_subnet_id: "{{ vpc.subnets[0].id }}"
assign_public_ip: True
instance_tags: { "Class":"webserver" }
wait: yes
register: ec2_info
- name: Wait for SSH to come up
local_action: wait_for host={{ item.public_ip }} port=22 delay=60 timeout=320 state=started
with_items: ec2_info.instances