Yep yep!

Paul nailed it.

Ideally every cloud module would support an exact_count like was done for
Rackspace and EC2, where it makes that number of containers exist.

Though I'm a little unclear why you'd want multiple docker containers on
the same host, the way that sucker runs (i.e. it's not a cloud API so those
images get all on the same box).

--Michael




On Wed, Apr 16, 2014 at 10:09 PM, Patrick Galbraith <[email protected]> wrote:

> Thanks! I could actually tinker with this. I'm comfortable with ansible
> source now, having a pull-request in for the nova_compute module (ahem :)
> What you describe seems to be the case and in fact I was running with -vvvv
> and noticed this.
>
>
> On Wednesday, April 16, 2014 7:41:36 PM UTC-4, Paul Durivage wrote:
>
>> 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/0274085d-cb0d-4450-bf63-326e39df5658%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/0274085d-cb0d-4450-bf63-326e39df5658%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/CA%2BnsWgyzF%3D8LnVdcOA69WKZeAEPtXQULzPNvDM0vyBcVpFC_GA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to