# A generic Handler ?

**URL:** <https://forum.ansible.com/t/a-generic-handler/35707>\
**Category:** Ansible Project\
**Created:** [September 3, 2021, 2:24pm UTC](https://forum.ansible.com/t/a-generic-handler/35707 "2021-09-03T14:24:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fred\_B](https://avatars.discourse-cdn.com/v4/letter/f/7ab992/32.png) [@Fred\_B](https://forum.ansible.com/u/Fred_B)\
**Post date:** [September 3, 2021, 2:24pm UTC](https://forum.ansible.com/t/a-generic-handler/35707/1 "2021-09-03T14:24:54Z")

</div>

Hello All,

I’m using ansible with a lot of managed docker images, and I’m searching a way to have a single handler for all my tasks, at least reduce my list of handlers …

Something like this (pseudo code)

Handler

```auto
- name: Run specific service docker compose
docker_compose:
project_src: "/opt/docker"
services: "{{ variable }}"
build: yes
pull: yes
state: present
restarted: yes

```

Task

```auto
- name: Set config runner2
vars:
variable: mycontainer
template:
src: runner2/config.toml
dest: "/opt/docker/runner2/config.toml"
owner: root
group: docker
mode: 0640
tags: rundocker
notify: Run specific service docker compose

```

When the file config.toml is changed only “mycontainer” is restarted

Any ideas would be appreciated  
Thanks !
