restart docker when mounted file changes

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:

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.