ES> I did try ec2.instances but it is only add the first host not all
ES> three. I did do a debug on ec2 and ec2.instances and it is showing all
ES> 3 instances that I'm turning up. Any ideas on that. This is only
ES> happening on the add_hosts module. I have a wait for ssh to come up
ES> task and ec2.instances var are giving me an ok for all three.

I tried with this trivial playbook, and it worked fine:

  - hosts: localhost 
    vars: 
      myhosts: [apple, banana, cherry] 
    tasks: 
      - debug: var=myhosts 
      - add_host: name={{ item }} groups=mygroup 
        with_items: myhosts 
      - debug: var=groups['mygroup'] 

I got

  TASK: [debug var=groups['mygroup']]
  ******************************************* 
  ok: [localhost] => {
      "var": {
          "groups['mygroup']": [
              "apple",
              "banana",
              "cherry"
          ]
      }
  }

as expected. Ansible 1.9.4 if it matters.

Does it work for you if you try a case like this that isn't ec2.instances?
If so, maybe there's something about the way ec2.instances is structured
that isn't what you expect, like it's a dict of lists of dicts of dicts of
lists rather than a list of dicts of dicts of lists, or something. :^)

                                      -Josh (j...@care.com)

(apologies for the automatic corporate disclaimer that follows)




This email is intended for the person(s) to whom it is addressed and may 
contain information that is PRIVILEGED or CONFIDENTIAL. Any unauthorized use, 
distribution, copying, or disclosure by any person other than the addressee(s) 
is strictly prohibited. If you have received this email in error, please notify 
the sender immediately by return email and delete the message and any 
attachments from your system.

-- 
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/22341.65207.793728.388574%40gargle.gargle.HOWL.
For more options, visit https://groups.google.com/d/optout.

Reply via email to