Changing "state: restarted" (rather than reloaded) might be enough -- 
otherwise try adding a "notify" to the task that is creating the config 
file, and a "handler" to explicitly stop and then start the container.

On Friday, 18 March 2016 20:00:15 UTC, Koen Janssens wrote:
>
> Hi, 
>
> I have an ansible tasklist that generates a cfg file from a template first 
> and then starts a docker container using that cfg file as a volume. 
>
> Works fine. 
>
> But when the generated cfg file changes (cfg file is actually generated 
> from ansible inventory) , the docker container is not restarted, since from 
> docker perspective nothing changed.Is there a way to 'force' ansible to 
> restart the container under cetain conditions ? 
>
> Thanks, 
>
> Koen
>
> Cfg: 
>
> ---
> - template: "src=members.conf.j2 dest={{ docker_host_dir }}/members.conf"
> - name: balancer
>   docker:
>      name: balancer
>      image: <...>
>      state: reloaded
>      net: "{{ docker_net }}"
>      ports:
>      - "8000:8000"
>      volumes:
>      - "{{ docker_host_dir 
> }}/members.conf:/usr/local/apache2/conf/members.conf"
>
>

-- 
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/021ea222-eca3-43dc-ac99-023949b229c0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to