# how to run perticular dependency role for specific host group

**URL:** <https://forum.ansible.com/t/how-to-run-perticular-dependency-role-for-specific-host-group/38758>\
**Category:** Ansible Project\
**Created:** [April 18, 2024, 11:18am UTC](https://forum.ansible.com/t/how-to-run-perticular-dependency-role-for-specific-host-group/38758 "2024-04-18T11:18:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sameer\_Modak](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sameer_modak/32/5180_2.png) [@Sameer\_Modak](https://forum.ansible.com/u/Sameer_Modak)\
**Post date:** [April 18, 2024, 11:18am UTC](https://forum.ansible.com/t/how-to-run-perticular-dependency-role-for-specific-host-group/38758/1 "2024-04-18T11:18:18Z")

</div>

Hello Team,

We have below grafana agent play.yaml and inside dependency we have mentioned below content now issue is kafka\_exporter role runs on all hosts. We want only to run on broker host how to achieve it??

grafana-agent-play.yaml

- name: “GRAgent Play”

hosts: all:!localhost

strategy: linear

order: sorted

become: no

gather\_facts: True

# See bug [Add support for ansible-playbook serial \> 1 (manage multiple hosts at a time) · Issue #153 · grafana/grafana-ansible-collection · GitHub](https://github.com/grafana/grafana-ansible-collection/issues/153) for parallel runs.

serial:

- 3

- 25%

- 50%

- 100%

vars:

ansible\_remote\_tmp: /tmp

tasks:

- name: Run roles under dependencies

ansible.builtin.include\_role:

name: “{{ dependent\_role }}”

with\_items: “{{ dependencies }}”

loop\_control:

loop\_var: dependent\_role

tags: [‘always’, ‘install’]

dependencies.yaml

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [April 18, 2024, 3:25pm UTC](https://forum.ansible.com/t/how-to-run-perticular-dependency-role-for-specific-host-group/38758/2 "2024-04-18T15:25:16Z")

</div>

Don't use dependencies, use include\_role and make it conditional

---

<div class="post-metadata">

**Author:** ![Sameer\_Modak](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sameer_modak/32/5180_2.png) [@Sameer\_Modak](https://forum.ansible.com/u/Sameer_Modak)\
**Post date:** [April 19, 2024, 12:30pm UTC](https://forum.ansible.com/t/how-to-run-perticular-dependency-role-for-specific-host-group/38758/3 "2024-04-19T12:30:43Z")

</div>

Thanks Brian.  
so there is no possibility to achieve with dependencies ryt??
