I'll venture a guess as to what is happening here, but I don't know for sure. I guess I could look at the source. ;)
I think what's happening here is that with_sequence is actually invoking a new module build/upload/run for every item in the with_sequence, and thereby overwriting the docker_containers variable with the facts from the last docker module run. So, it's a guess, but you could probably verify that by running with some extra verbosity (I think you need at least -vv). This is definitely not happening in the first container launch, because it's passing those values directly to the module, running only once. If you don't give it a shot, I'll probably take a look at it in the morning. Let me know what you find! On Wed, Apr 16, 2014 at 4:41 PM, Patrick Galbraith <[email protected]> wrote: > Hi all! > > I have what I think is a simple question. It pertains to what is > visible/available in the "docker_containers" dictionary when running a run > book. > > Ok, so, what’s throwing me off is whether to use one of the following: > > - name launch containers > > docker: image=df02bd73464a count={{ start_containers_count }} > > Or > > - name launch containers > > docker: image=df02bd73464a name=somename_{{item}} > > with_sequence: count={{ start_containers_count }} > > It is the first snippet that works for doing this next task: > > - name: print container info > > debug: msg="{{item['NetworkSettings']['IPAddress']}}" > > with_items: docker_containers > > Why? Because the latter results in “docker_containers” only having the > last container’s information (last container launched), whereas the former > gives me all of them. > > > It’s probably something really simple… > > -- > 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/5145e9f6-0aa0-45ee-af33-c50c37d82b06%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/5145e9f6-0aa0-45ee-af33-c50c37d82b06%40googlegroups.com?utm_medium=email&utm_source=footer> > . > 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/CAK6JQEECqiyiF_hCr0OLBvSC0q27Kz859oxy58s3k%2BgKE-AFmA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
