How can tell my docker_container module to always pull an Image only sometimes when i specify using extra vars or something

11 views
Skip to first unread message

ishan jain

unread,
Nov 30, 2016, 7:30:01 AM11/30/16
to Ansible Project
I have a number of playbooks each related to starting a container for a microservice using docker_container module. I supply the variables like image name from the outside using YAML var files. Since we never update a tagged image in our repo, we have deliberately not used "pull: always" in the module as it will pull image if absent anyways and there will never be an update to that image ever. This is the reason that i don't want to change that for a specific scenario i have encountered.

I am working on experimental images for these microservices and i am using the same playbooks to install them. Now there is a single tag for these experimental images and it keeps on updating in the repo and to handle that, i need to tell the docker_container module to always pull. I do not wish to change the scripts but i have the flexibility to provide extra vars to the playbook. I cannot even do something like adding the pull: {{var}} to the playbooks with the default value of var as false but changing it to true in my case. The original scripts shall remain untouched.

How can i tell the docker_container to always pull with the help of extra vars.

Maybe i should ask a more generic question. It will be cool if this is possible.

How can i override/add the values of parameters of a module inside the playbook/role with the help of extra vars ?

ishan jain

unread,
Dec 5, 2016, 8:00:24 AM12/5/16
to Ansible Project
Bump!!
There is got to be some trick involved but i can't think of any.
Reply all
Reply to author
Forward
0 new messages