# Conditionally upgrade container (specific version)

**URL:** <https://forum.ansible.com/t/conditionally-upgrade-container-specific-version/17243>\
**Category:** Ansible Project\
**Created:** [January 12, 2015, 4:45pm UTC](https://forum.ansible.com/t/conditionally-upgrade-container-specific-version/17243 "2015-01-12T16:45:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gary\_Malouf](https://avatars.discourse-cdn.com/v4/letter/g/4bbf92/32.png) [@Gary\_Malouf](https://forum.ansible.com/u/Gary_Malouf)\
**Post date:** [January 12, 2015, 4:45pm UTC](https://forum.ansible.com/t/conditionally-upgrade-container-specific-version/17243/1 "2015-01-12T16:45:53Z")

</div>

I’m trying to achieve the following behavior via the Ansible-Docker module

1. Check if currently deployed container image is of desired version; if so, exit else proceed
2. Pull updated image
3. Stop/remove currently deployed container image
4. Start new container image

I know using ‘latest’ would give this type of behavior, but we really want to be able to specify the specific version to check for.

---

<div class="post-metadata">

**Author:** ![Peter\_Mooshammer](https://avatars.discourse-cdn.com/v4/letter/p/c5a1d2/32.png) [@Peter\_Mooshammer](https://forum.ansible.com/u/Peter_Mooshammer)\
**Post date:** [January 13, 2015, 5:27pm UTC](https://forum.ansible.com/t/conditionally-upgrade-container-specific-version/17243/2 "2015-01-13T17:27:22Z")

</div>

Yeah - that would be a nice feature 🙂

A pull only option in the docker module, that lets you know if you have to restart the service or not. And restarts AFTER the pull is complete.

Peter
