Task execution for host within multiple host groups and different aliases

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