Would you mind to post your ec2.ini with the credentials taken out? Also, 
what is the output of ec2.py when you run it alone?

On Friday, September 16, 2016 at 12:15:39 AM UTC-7, Nirav Radia wrote:
>
> Hi all,
>
> I am pretty new to Ansible. I am using ec2.py to connect to my EC2 
> instances and run my ansible scripts on them. Previously, it was working 
> fine when I was using "all" regions. But now when I change the region to a 
> specific one region (any of the available ones), in ec2.ini, it gives me 
> below error for the first time and after second time onward, it works well.
>
> UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via 
> ssh.", "unreachable": true}
>
>
> What I do is use ec2 module to create a instance and then wait_for port 22 
> on each host to be up. It wait successfully and moves forward but in the 
> immediate next step when I try to connect to the instance, it gives above 
> error first time. Here is my wait_for task: (ec2_server is the variable 
> registered from ec2 module)
>
> name: wait for ssh server to be running
>     wait_for: host={{ item.public_dns_name }} port=22
>     with_items: "{{ec2_server.instances | default([])}}"
>     when: item.state == 'running'
>
>
> I ping in between to the instance using private ip and the ping succeeds. 
> I suspect it is some timing issue or DNS name resolution issue with AWS. 
> Has anyone faced such problem before?
>
> Any help would be appreciated. Thanks !
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0384a64c-46af-4686-bdf7-1ff42b90d8e9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to