Since Ansible does not support instance registration for target groups, I had to use the AWS-CLI tool. Using the following command, you can register an instance in the target group:
aws elbv2 register-targets --target-group-arn arn:aws:elasticloadbalancing:us-east-1:your-target-group --targets Id=i-your-instance
So, I just call this command from Ansible and it is done.
source share