# ansible 2.0: limit not working as intended ?

**URL:** <https://forum.ansible.com/t/ansible-2-0-limit-not-working-as-intended/20195>\
**Category:** Ansible Project\
**Created:** [January 13, 2016, 11:56am UTC](https://forum.ansible.com/t/ansible-2-0-limit-not-working-as-intended/20195 "2016-01-13T11:56:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_C1](https://avatars.discourse-cdn.com/v4/letter/m/51bf81/32.png) [@Mike\_C1](https://forum.ansible.com/u/Mike_C1)\
**Post date:** [January 13, 2016, 11:56am UTC](https://forum.ansible.com/t/ansible-2-0-limit-not-working-as-intended/20195/1 "2016-01-13T11:56:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [January 13, 2016, 1:03pm UTC](https://forum.ansible.com/t/ansible-2-0-limit-not-working-as-intended/20195/2 "2016-01-13T13:03:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Mike\_C1](https://avatars.discourse-cdn.com/v4/letter/m/51bf81/32.png) [@Mike\_C1](https://forum.ansible.com/u/Mike_C1)\
**Post date:** [January 13, 2016, 1:24pm UTC](https://forum.ansible.com/t/ansible-2-0-limit-not-working-as-intended/20195/3 "2016-01-13T13:24:24Z")

</div>

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

---

<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:** [January 13, 2016, 2:45pm UTC](https://forum.ansible.com/t/ansible-2-0-limit-not-working-as-intended/20195/4 "2016-01-13T14:45:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [January 13, 2016, 3:17pm UTC](https://forum.ansible.com/t/ansible-2-0-limit-not-working-as-intended/20195/5 "2016-01-13T15:17:04Z")

</div>

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

Thanks!

---

<div class="post-metadata">

**Author:** ![Mike\_C1](https://avatars.discourse-cdn.com/v4/letter/m/51bf81/32.png) [@Mike\_C1](https://forum.ansible.com/u/Mike_C1)\
**Post date:** [January 13, 2016, 3:40pm UTC](https://forum.ansible.com/t/ansible-2-0-limit-not-working-as-intended/20195/6 "2016-01-13T15:40:16Z")

</div>

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

Cheers  
Mike
