# Added support for Docker's 'restart\_policy' (PR 504)

**URL:** <https://forum.ansible.com/t/added-support-for-dockers-restart-policy-pr-504/17046>\
**Category:** Ansible Developer\
**Created:** [December 13, 2014, 3:22pm UTC](https://forum.ansible.com/t/added-support-for-dockers-restart-policy-pr-504/17046 "2014-12-13T15:22:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Viktor\_Petersson](https://avatars.discourse-cdn.com/v4/letter/v/9fc348/32.png) [@Viktor\_Petersson](https://forum.ansible.com/u/Viktor_Petersson)\
**Post date:** [December 13, 2014, 3:22pm UTC](https://forum.ansible.com/t/added-support-for-dockers-restart-policy-pr-504/17046/1 "2014-12-13T15:22:54Z")

</div>

Hey guys,

I really like ‘restart\_policy’ in Docker (introduced in 1.2). Unfortunately, this feature is not supported in Ansible at this point. To solve this, I decided to block some time today to hack together this support. The Pull request is available here [1].

Since I haven’t contributed to Ansible before, I don’t know the exact process for this. In any case, I’ve tested this with success on 1.8.2.

Let me know what you think.

Thanks.

[1] [https://github.com/ansible/ansible-modules-core/pull/504](https://github.com/ansible/ansible-modules-core/pull/504)

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [December 15, 2014, 11:41am UTC](https://forum.ansible.com/t/added-support-for-dockers-restart-policy-pr-504/17046/2 "2014-12-15T11:41:33Z")

</div>

Hi Victor,

You will need to add a “version\_added: ‘1.8’” to the new param in the documentation block.

As for this part in the docs, it seems to contradict a little with the example? I’m wondering if the param should take a dict instead of whether we should show additional examples.

The module parameter in the argument\_spec seems to take a dict which conflicts with the example value of ‘always’.

Thoughts?

The syntax is ‘:’ or ', where ‘policy’ can be ‘always’ or ‘on\_failure’. ‘count’ is optional, and set to ‘0’ (unlimited) if not explictly set. Set to ‘0’ for no limit. Requires Docker \>= 1.2.0.
