On Thu, Sep 25, 2014 at 5:36 PM, Brian Fleming <[email protected]>
wrote:

> My understanding is if I have a playbook that says
>
> - hosts:  localhost
>   sudo: yes
>   tasks:
>   - name: ensure redis container is running
>     docker: image=dockerfile/redis name=redis command=" bash -c
> 'redis-server  /etc/redis/redis.conf'"
>
>   - name: ensure web container is running
>     docker: image=snazzy/cyweb ports=5000:5000 links=redis:redis name=cyweb
>
>
> Then if the image for cyweb gets updated with a new version shouldn't the
> ansible/docker module replace my container?
>
> Even if I explicitly give it a tag. I tell it HERE, goto this version.
>
>   - name: ensure redis container is running
>     docker: image=dockerfile/redis name=redis command=" bash -c
> 'redis-server  /etc/redis/redis.conf'"
>
>   - name: Kill old container
>     docker: image=snazzy/cyweb ports=5000:5000 links=redis:redis
> name=cyweb state=absent
>
>   - name: ensure web container is running
> *    docker: image=snazzy/cyweb:3.0* ports=5000:5000 links=redis:redis
> name=cyweb
>
>
>
>From your comment in the next section, I wonder if the example above isn't
supposed to have the "Kill old container" task?


> It still does not update.
>
> The only thing I found that works is if I kill the container first.
>
>   - name: ensure redis container is running
>     docker: image=dockerfile/redis name=redis command=" bash -c
> 'redis-server  /etc/redis/redis.conf'"
>
> *  - name: Kill old container*
> *    docker: image=snazzy/cyweb ports=5000:5000 links=redis:redis
> name=cyweb state=absent*
>
>   - name: ensure web container is running
>     docker: image=snazzy/cyweb ports=5000:5000 links=redis:redis name=cyweb
>
> Assuming that:
1) The kill old container task isn't supposed to be present in the second
example
2) The snazzy/cyweb container is running a long running process
3) Manually running docker's tools does something similar

I think this behaviour is intended.

This seems like we're just asking the docker module to guarantee that the
service is running.  Not to restart the service.  I think we need to be
explicit here that we aren't just saying "ensure service is running" but
are actually saying "restart the service, picking up a new version if
that's deployed".

-Toshio

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

Reply via email to