ansible 2.0: limit not working as intended ?

im creating my hosts file with

for f in $(seq 1 10); do echo “host$f” >> hosts; done

and then try to list hosts with

ansible all -i hosts --limit ~host1 --list-hosts

with this result

hosts (10):
host1
host2
host3
host4
host5
host6
host7
host8
host9
host10

Also non regex limit reutnrs

ansible all -i hosts --limit host4 --list-hosts
hosts (10):
host1
host2
host3
host4
host5
host6
host7
host8
host9
host10

I’ve tried googling but nothing came up. Has there been any changes ?

ansible 2.0.0.0
config file = /etc/ansible/ansible.cfg
configured module search path = /usr/share/ansible

and i’ve installed itwith pip install --user ansible --upgrade.

Cheers,
Mike

Are you seeing this just with --list-hosts or are you seeing it when running a playbook too?

playbooks are all right (playbook fails cause hosts are not real btw).

ansible-playbook test.yml -i hosts --limit ~host1

PLAY ***************************************************************************

TASK [setup] *******************************************************************
fatal: [host1]: UNREACHABLE! => {“changed”: false, “msg”: “ERROR! SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to help diagnose the issue”, “unreachable”: true}
fatal: [host10]: UNREACHABLE! => {“changed”: false, “msg”: “ERROR! SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to help diagnose the issue”, “unreachable”: true}

PLAY RECAP *********************************************************************
host1 : ok=0 changed=0 unreachable=1 failed=0
host10 : ok=0 changed=0 unreachable=1 failed=0

This is probably a bug that just affects --list-hosts.

I agree. Mike, can you open an issue on github for us so we can keep track of this?

Thanks!

reported (https://github.com/ansible/ansible/issues/13848)

Cheers
Mike