I am having a weird issue when launching ec2 instances. I have a playbook 
where I launch an instance into a private VPC, using item.private_ip etc. 

My ssh config is setup to proxy requests to any host in this subnet. I can 
ssh successfully into any host, using my bastion and ssh config, so I know 
this is working correctly.

When I am launching an ec2 instance, my wait_for local action always times 
out, it can't connect "msg: Timeout when waiting for <private ip>", 
however, after the playbook fails I can ssh into this host, and adding this 
host into my inventory file also works.

- hosts: localhost
>
>   connection: local
>
>   gather_facts: False
>
>   vars:
>
>     instance_count: 1
>
>   tasks:
>
>     - name: Create instances
>
>       local_action:
>
>         module: ec2
>
>         region: us-west-2
>
>         group_id: ****
>
>         keypair: ***
>
>         instance_type: t2.micro
>
>         image: ****
>
>         vpc_subnet_id: ****
>
>         count: "{{ instance_count }}"
>
>         wait: yes
>
>       register: ec2
>
>
>     - name: Add instances to inventory
>
>       add_host: name={{ item.private_ipi }} groups=new_instances
>
>       with_items: ec2.instances
>
>
>     - name: Wait for SSH
>
>       local_action: wait_for
>
>                       host={{ item.private_ip }}
>
>                       port=22
>
>                       state=started
>
>       with_items: ec2.instances
>
>
> - name: Configure
>
>   hosts: new_instances
>
>   gather_facts: True
>
>   remote_user: ***
>
>   sudo: True
>
>   roles:
>
>     - ***
>


 

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1767c725-3cdf-4a93-a226-01aeb9394736%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to