# Host classification problem

**URL:** <https://forum.ansible.com/t/host-classification-problem/22162>\
**Category:** Ansible Project\
**Created:** [July 29, 2016, 11:15am UTC](https://forum.ansible.com/t/host-classification-problem/22162 "2016-07-29T11:15:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jan\_Jungmann](https://avatars.discourse-cdn.com/v4/letter/j/a183cd/32.png) [@Jan\_Jungmann](https://forum.ansible.com/u/Jan_Jungmann)\
**Post date:** [July 29, 2016, 11:15am UTC](https://forum.ansible.com/t/host-classification-problem/22162/1 "2016-07-29T11:15:03Z")

</div>

Hi all,

I am having a problem with host classification. In my hosts file i have a “nodejs:children” group with application “foo”. “foo” has server-a. In site.yml I use hosts: nodejs:&{{ application }} and assign a role. This works well with multiple applications until the same server is configured in multiple groups. Then multiple roles are applied. I would expect only 1 role applied. Any idea what is going wrong? Here is the relevant files:

hosts:

```auto

[nodejs:children]
foo
[java:children]
bar
[foo]
localhost
[bar]
localhost

```

site.yml:

```auto

---

- name: deploy nodejs app

hosts: nodejs:&{{ application }}

roles:

- nodejs

- name: deploy java app

hosts: java:&{{ application }}

roles:

- java

```

command:

```auto

ansible-playbook site.yml -i hosts --check -e 'application=foo'

```

Thanks,  
Jan

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [February 10, 2017, 3:27am UTC](https://forum.ansible.com/t/host-classification-problem/22162/2 "2017-02-10T03:27:52Z")

</div>

The hostnames in inventory are unique, if you define a host in more  
than one place, it is the same host.
