# Task execution for host within multiple host groups and different aliases

**URL:** <https://forum.ansible.com/t/task-execution-for-host-within-multiple-host-groups-and-different-aliases/21750>\
**Category:** Ansible Project\
**Created:** [June 13, 2016, 8:13am UTC](https://forum.ansible.com/t/task-execution-for-host-within-multiple-host-groups-and-different-aliases/21750 "2016-06-13T08:13:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thms\_Hmm](https://avatars.discourse-cdn.com/v4/letter/t/ed8c4c/32.png) [@Thms\_Hmm](https://forum.ansible.com/u/Thms_Hmm)\
**Post date:** [June 13, 2016, 8:13am UTC](https://forum.ansible.com/t/task-execution-for-host-within-multiple-host-groups-and-different-aliases/21750/1 "2016-06-13T08:13:54Z")

</div>

I’m struggling with hosts that belong to multiple host groups and have different aliases. The problem i’m facing is, that if i try to execute a task on group “all\_hosts” where each group belongs to, the task is executed for each alias and not on a ansible\_host basis.

I expect that the task is only executed once for the host. Independent of the alias.

The inventory i’m using looks like this:

[all\_hosts:children]  
group1  
group2

[group1]  
host-alias-1-group-1 ansible\_host=host-1

[group2]  
host-alias-1-group-2 ansible\_host=host-1

I can create the all\_hosts group like this:

[all\_hosts:children]  
host-alias-1-group-all ansible\_host=host-1

…but that seems like a workaround. Any advice would be appreciated.

Thms
