# Ansible: Is the any chance of maintain same tag same role but diffrent host name in main yml file by putting any when condition from tasks inside role.

**URL:** <https://forum.ansible.com/t/ansible-is-the-any-chance-of-maintain-same-tag-same-role-but-diffrent-host-name-in-main-yml-file-by-putting-any-when-condition-from-tasks-inside-role/33847>\
**Category:** Ansible Project\
**Created:** [September 18, 2020, 7:54am UTC](https://forum.ansible.com/t/ansible-is-the-any-chance-of-maintain-same-tag-same-role-but-diffrent-host-name-in-main-yml-file-by-putting-any-when-condition-from-tasks-inside-role/33847 "2020-09-18T07:54:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Venu\_Devannagari](https://avatars.discourse-cdn.com/v4/letter/v/d2c977/32.png) [@Venu\_Devannagari](https://forum.ansible.com/u/Venu_Devannagari)\
**Post date:** [September 18, 2020, 7:54am UTC](https://forum.ansible.com/t/ansible-is-the-any-chance-of-maintain-same-tag-same-role-but-diffrent-host-name-in-main-yml-file-by-putting-any-when-condition-from-tasks-inside-role/33847/1 "2020-09-18T07:54:37Z")

</div>

I have tried to maintain my main yml file like below

---

<div class="post-metadata">

**Author:** ![Gajendra\_Gaikwad1](https://avatars.discourse-cdn.com/v4/letter/g/9de053/32.png) [@Gajendra\_Gaikwad1](https://forum.ansible.com/u/Gajendra_Gaikwad1)\
**Post date:** [September 19, 2020, 6:41pm UTC](https://forum.ansible.com/t/ansible-is-the-any-chance-of-maintain-same-tag-same-role-but-diffrent-host-name-in-main-yml-file-by-putting-any-when-condition-from-tasks-inside-role/33847/2 "2020-09-19T18:41:49Z")

</div>

```auto
Hi,

```

```auto

```

```auto
when: inventory_hostname in groups['small_group']

```

```auto
Or 

```
