Hi Christian,

You are correct that there is a wait parameter to the ec2 module but
unfortunately it will probably not get you what you want since an ec2
instance in the "running" state does not necessary mean you can ssh to
it.
What we should probably add to this module is a wait for the system
status check to be 'ok' which is what I do typically when using boto
in python code.

To solve your immediate problem I wouldn't use a prompt; instead you
can wait for ssh to become available using the the wait_for module.

Example:

# register the var "ec2" when you launch it using the ec2 module

- name: Add new instance to host group
  local_action: >
    add_host
      hostname={{ item.public_ip }}
      groupname=launched
  with_items: ec2.instances

- name: Wait for SSH to come up
  local_action: >
    wait_for
      host={{ item.public_dns_name }}
      state=started
      port=22
      delay=60
      timeout=320
  with_items: ec2.instances


As for idempotent behavior with the ec2 module you can use the id
parameter, see 
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Run_Instance_Idempotency.html

-John


On Tue, Apr 8, 2014 at 1:46 PM, Christian Kaps <[email protected]> wrote:
> I think the wait property on the EC2 module is exactly what I want.
>
> Thanks
>
> Am Dienstag, 8. April 2014 09:13:59 UTC+2 schrieb Christian Kaps:
>>
>> Hi,
>>
>> in the most Playbooks about EC2 provisioning there exists a task which
>> executes the pause module to wait for the instance to be available. Now that
>> the EC2 module supports idempotency it is possible to run a playbook
>> multiple times to add new features to an already provisioned instance. The
>> problem now is that the pause module runs every time and waits for e.g. 2
>> minutes. I know that I can use ^C-c to continue the task. But I think the
>> best solution would be to execute the wait task only after the instance was
>> provisioned. Is there any possibility to achieve such a behavior?
>>
>> Cheers,
>> Christian
>
> --
> 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/ccd1cf5f-d344-4c9f-9860-28c012bdabfc%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

-- 
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/CADPH6PJ4wRn-UhO3B4jwY0RB5AgxDTuwf2jKzYYySQt0dni8aA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to