# Docker Compose Module Issue - Trying to Stop Some Services

**URL:** <https://forum.ansible.com/t/docker-compose-module-issue-trying-to-stop-some-services/32893>\
**Category:** Ansible Project\
**Created:** [May 9, 2020, 3:32am UTC](https://forum.ansible.com/t/docker-compose-module-issue-trying-to-stop-some-services/32893 "2020-05-09T03:32:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kernel\_Panic](https://avatars.discourse-cdn.com/v4/letter/k/db5fbb/32.png) [@Kernel\_Panic](https://forum.ansible.com/u/Kernel_Panic)\
**Post date:** [May 9, 2020, 3:32am UTC](https://forum.ansible.com/t/docker-compose-module-issue-trying-to-stop-some-services/32893/1 "2020-05-09T03:32:21Z")

</div>

Hello there, hope this is the right place to ask.

Im trying to accomplish the following using docker\_compose module, the idea is, I have a compose file which runs  
some services and I want to stop some of them but not all, I know beforehands the ones that I do not want to stop, so  
am trying to do the following, define vars with the services I do not want to stop, leave them running but the rest.  
somehow this is not working for me, the when clause seems not to be being evaluated, services variable and  
running\_services fact show their content, so is not empty, maybe the services tag in docker\_compose expects something  
different, if I run the following it just stops all the services.

Any hint really appreciated.

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [May 9, 2020, 5:51am UTC](https://forum.ansible.com/t/docker-compose-module-issue-trying-to-stop-some-services/32893/2 "2020-05-09T05:51:54Z")

</div>

> Hello there, hope this is the right place to ask.
> 
> Im trying to accomplish the following using docker\_compose module, the idea is, I have a compose file which runs  
> some services and I want to stop some of them but not all, I know beforehands the ones that I do not want to stop, so  
> am trying to do the following, define vars with the services I do not want to stop, leave them running but the rest.  
> somehow this is not working for me, the when clause seems not to be being evaluated, services variable and  
> running\_services fact show their content, so is not empty, maybe the services tag in docker\_compose expects something  
> different, if I run the following it just stops all the services.
> 
> Any hint really appreciated.

I think that defeats the purpose of docker-compose. You could stop the services with the docker\_container module.

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke
