Why is my instance failing ELB health checks when adding it to the load balancer via Ansible?

Solution 1:

Adapted from my earlier comment:

Judging from the Ansible docs, there's a wait_timeout parameter which you will have to set to something higher than 300 for this to work. (330 would be safe).

Or you could lower your interval or healthy_threshold or both so that you have to wait less than 300 seconds.

Your unhealthy_threshold is the same as the healthy_threshold, so once a web server starts throwing 500 responses, it will stay in the pool for 5 minutes before the ELB drops it.

Solution 2:

You can use ec2_elb option wait: no.