<h5 dir="auto">Issue Type: Bug Report</h5>
<h5 dir="auto">Ansible Version:</h5>
<p dir="auto">$ ansible --version<br>
ansible 2.0.0.2<br>
config file = /home/xaeth/.ansible.cfg<br>
configured module search path = Default w/o overrides</p>
<h5 dir="auto">Ansible Configuration:</h5>
<p dir="auto">What have you changed about your Ansible installation?</p>
<p dir="auto">My /etc/ansible/ansible.cfg is default Fedora version, which appears to be the stock examples cfg.  My cfg changes the following:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[ssh_connection]
ssh_args = -o ForwardAgent=yes -o PubkeyAuthentication=yes"><pre class="notranslate"><code class="notranslate">[ssh_connection]
ssh_args = -o ForwardAgent=yes -o PubkeyAuthentication=yes
</code></pre></div>
<h5 dir="auto">Environment:</h5>
<p dir="auto">Fedora 22</p>
<h5 dir="auto">Summary:</h5>
<p dir="auto">As of v2 limiting is broken with static inventory.</p>
<h5 dir="auto">Reproduction:</h5>
<p dir="auto">Using the attached <a href="https://github.com/ansible/ansible/files/102805/inventory.txt">inventory.txt</a></p>
<ul dir="auto">
<li>Ansible 1.9.4</li>
</ul>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ ansible all --list-hosts -i inventory.txt -l 'app1'
    app1-n01.dc1.dev.example.com
    app1-n02.dc1.dev.example.com
    app1-n01.dc2.dev.example.com
    app1-n02.dc2.dev.example.com
$ ansible all  --list-hosts -i inventory.txt -l 'app2'
    app2-n01.dc1.dev.example.com
    app2-n02.dc1.dev.example.com
    app2-n01.dc2.dev.example.com
    app2-n02.dc2.dev.example.com
$ ansible all --list-hosts -i inventory.txt -l 'app1:&amp;dc1'
    app1-n01.dc1.dev.example.com
    app1-n02.dc1.dev.example.com"><pre class="notranslate"><code class="notranslate">$ ansible all --list-hosts -i inventory.txt -l 'app1'
    app1-n01.dc1.dev.example.com
    app1-n02.dc1.dev.example.com
    app1-n01.dc2.dev.example.com
    app1-n02.dc2.dev.example.com
$ ansible all  --list-hosts -i inventory.txt -l 'app2'
    app2-n01.dc1.dev.example.com
    app2-n02.dc1.dev.example.com
    app2-n01.dc2.dev.example.com
    app2-n02.dc2.dev.example.com
$ ansible all --list-hosts -i inventory.txt -l 'app1:&amp;dc1'
    app1-n01.dc1.dev.example.com
    app1-n02.dc1.dev.example.com
</code></pre></div>
<ul dir="auto">
<li>Ansible 2.0.0.2</li>
</ul>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ ansible all --list-hosts -i inventory.txt -l 'app1'
  hosts (8):
    app2-n01.dc1.dev.example.com
    app2-n02.dc1.dev.example.com
    app2-n01.dc2.dev.example.com
    app2-n02.dc2.dev.example.com
    app1-n01.dc1.dev.example.com
    app1-n02.dc1.dev.example.com
    app1-n01.dc2.dev.example.com
    app1-n02.dc2.dev.example.com
$ ansible all  --list-hosts -i inventory.txt -l 'app2'
  hosts (8):
    app2-n01.dc1.dev.example.com
    app2-n02.dc1.dev.example.com
    app2-n01.dc2.dev.example.com
    app2-n02.dc2.dev.example.com
    app1-n01.dc1.dev.example.com
    app1-n02.dc1.dev.example.com
    app1-n01.dc2.dev.example.com
    app1-n02.dc2.dev.example.com
$ ansible all --list-hosts -i inventory.txt -l 'app1:&amp;dc1'
  hosts (8):
    app2-n01.dc1.dev.example.com
    app2-n02.dc1.dev.example.com
    app2-n01.dc2.dev.example.com
    app2-n02.dc2.dev.example.com
    app1-n01.dc1.dev.example.com
    app1-n02.dc1.dev.example.com
    app1-n01.dc2.dev.example.com
    app1-n02.dc2.dev.example.com"><pre class="notranslate"><code class="notranslate">$ ansible all --list-hosts -i inventory.txt -l 'app1'
  hosts (8):
    app2-n01.dc1.dev.example.com
    app2-n02.dc1.dev.example.com
    app2-n01.dc2.dev.example.com
    app2-n02.dc2.dev.example.com
    app1-n01.dc1.dev.example.com
    app1-n02.dc1.dev.example.com
    app1-n01.dc2.dev.example.com
    app1-n02.dc2.dev.example.com
$ ansible all  --list-hosts -i inventory.txt -l 'app2'
  hosts (8):
    app2-n01.dc1.dev.example.com
    app2-n02.dc1.dev.example.com
    app2-n01.dc2.dev.example.com
    app2-n02.dc2.dev.example.com
    app1-n01.dc1.dev.example.com
    app1-n02.dc1.dev.example.com
    app1-n01.dc2.dev.example.com
    app1-n02.dc2.dev.example.com
$ ansible all --list-hosts -i inventory.txt -l 'app1:&amp;dc1'
  hosts (8):
    app2-n01.dc1.dev.example.com
    app2-n02.dc1.dev.example.com
    app2-n01.dc2.dev.example.com
    app2-n02.dc2.dev.example.com
    app1-n01.dc1.dev.example.com
    app1-n02.dc1.dev.example.com
    app1-n01.dc2.dev.example.com
    app1-n02.dc2.dev.example.com
</code></pre></div>
<p dir="auto">as described <a href="https://groups.google.com/forum/#!topic/ansible-project/sxuZfahMRUI" rel="nofollow">here</a>, this doesn't work</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ ansible all -i hosts --limit ~host1 --list-hosts
hosts (10):
    host1
    host2
    host3
    host4
    host5
    host6
    host7
    host8
    host9
    host10"><pre class="notranslate"><code class="notranslate">$ ansible all -i hosts --limit ~host1 --list-hosts
hosts (10):
    host1
    host2
    host3
    host4
    host5
    host6
    host7
    host8
    host9
    host10
</code></pre></div>
<p dir="auto">nor this</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible all -i hosts --limit host4 --list-hosts
  hosts (10):
    host1
    host2
    host3
    host4
    host5
    host6
    host7
    host8
    host9
    host10"><pre class="notranslate"><code class="notranslate">ansible all -i hosts --limit host4 --list-hosts
  hosts (10):
    host1
    host2
    host3
    host4
    host5
    host6
    host7
    host8
    host9
    host10
</code></pre></div>
<p dir="auto">but this will</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible-playbook test.yml -i hosts --limit ~host1

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

TASK [setup] *******************************************************************
fatal: [host1]: UNREACHABLE! =&gt; {&quot;changed&quot;: false, &quot;msg&quot;: &quot;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&quot;, &quot;unreachable&quot;: true}
fatal: [host10]: UNREACHABLE! =&gt; {&quot;changed&quot;: false, &quot;msg&quot;: &quot;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&quot;, &quot;unreachable&quot;: true}

PLAY RECAP *********************************************************************
host1                      : ok=0    changed=0    unreachable=1    failed=0   
host10                     : ok=0    changed=0    unreachable=1    failed=0   "><pre class="notranslate"><code class="notranslate">ansible-playbook test.yml -i hosts --limit ~host1

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

TASK [setup] *******************************************************************
fatal: [host1]: UNREACHABLE! =&gt; {"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! =&gt; {"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   
</code></pre></div>
<p dir="auto">ansible version:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.0.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = /usr/share/ansible"><pre class="notranslate"><code class="notranslate">ansible 2.0.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = /usr/share/ansible
</code></pre></div>
<p dir="auto">installation through <code class="notranslate">pip install --user ansible --upgrade</code>.<br>
My hosts file was generate with <code class="notranslate">for f in $(seq 1 10); do echo "host$f" &gt;&gt; hosts; done</code></p>