boto (2.40.0) ansible 2.0.2.0

When running this and trying to add multiple hosts to a new group for in 
memory inventory it only adding the first ec2 instance. On the wait for ssh 
task it does wait for all ec2 instances just not on the add host task.


- hosts: ec2_instances
  connection: local
  gather_facts: true
  tasks:
    - name: Launch Instance
      ec2:
        group_id: "{{ hostvars[inventory_hostname].group_id }}"
        count: 1
        instance_type: 't2.micro'
        image: "{{ hostvars[inventory_hostname].image }}"
        wait: true
        region: 'us-east-1'
        keypair: "{{ key_pair }}"
        vpc_subnet_id: "{{ priv_subnet }}"
        instance_tags: "{{ hostvars[inventory_hostname].tags }}"
        register: ec2

     - name: Wait for SSH
       wait_for:
         host: "{{ item.private_ip }}"
         port: 22
         delay: 10
         timeout: 320
         state: started
       with_items: "{{ ec2.instances }}"

    - name: Add hosts group temporary inventory group
      add_host: name={{ item.private_ip }} groups=dynamic_hosts
      with_items: "{{ ec2.instances }}"

- hosts: dynamic_hosts
  gather_facts: yes
  sudo: yes
  roles:
    - ansible-hostname-master


-- 


This email communication (including any attachments) contains information 
from Answers Corporation or its affiliates that is confidential and may be 
privileged. The information contained herein is intended only for the use 
of the addressee(s) named above. If you are not the intended recipient (or 
the agent responsible to deliver it to the intended recipient), you are 
hereby notified that any dissemination, distribution, use, or copying of 
this communication is strictly prohibited. If you have received this email 
in error, please immediately reply to sender, delete the message and 
destroy all copies of it. If you have questions, please email 
[email protected]. 

If you wish to unsubscribe to commercial emails from Answers and its 
affiliates, please go to the Answers Subscription Center 
http://campaigns.answers.com/subscriptions to opt out.  Thank you.

-- 
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/e5548b66-9438-4825-8a2b-42f39e7f5f7b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to