localhost in multiple groups (e.g. all) as well as "ungrouped"

I’ve found a regression in Ansible 2.1.1.0 where group_vars are not being applied correctly to a host that is shown as part of those groups.

My playbook is for performing AWS operations.

My inventory file looks something like this:

[control_host]
localhost connection=local
[nonprod]
[eu-nonprod]
[eu-west-1]
[demo]
[eu-west-1:children]

control_host
[demo:children]

control_host
[nonprod:children]

eu-nonprod
demo
[eu-nonprod:children]

eu-west-1

When I run this with Ansible 2.1.1 my groups_vars are not picked up – including values set in group_vars/all.yml. With 2.1.0 group_vars are set as expected.

I’m not sure this is connected, but I’ve noticed that localhost is shown as belonging to all expected groups when running with 2.1.0 – and with Ansible 2.1.1 localhost is shown to belong to the “ungrouped” group as well.

TASK [debug] *******************************************************************
ok: [localhost] => {
“groups”: {
“all”: [
“localhost”
],
“control_host”: [
“localhost”
],
“demo”: [
“localhost”
],
“eu-nonprod”: [
“localhost”
],
“eu-west-1”: [
“localhost”
],
“nonprod”: [
“localhost”
],
“ungrouped”: [
“localhost”
]
}
}

Am I missing something here? Should I open an issue about this?

Thanks,
David