# Is the following ansible documentation incorrect? "the first 10: --limit boston\[1:10\]". Shouldn't it be "--limit boston\[0:9\]"

**URL:** <https://forum.ansible.com/t/is-the-following-ansible-documentation-incorrect-the-first-10-limit-boston-1-10-shouldnt-it-be-limit-boston-0-9/26629>\
**Category:** Ansible Project\
**Created:** [February 1, 2018, 9:49pm UTC](https://forum.ansible.com/t/is-the-following-ansible-documentation-incorrect-the-first-10-limit-boston-1-10-shouldnt-it-be-limit-boston-0-9/26629 "2018-02-01T21:49:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_Cavedon](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@Mike\_Cavedon](https://forum.ansible.com/u/Mike_Cavedon)\
**Post date:** [February 1, 2018, 9:49pm UTC](https://forum.ansible.com/t/is-the-following-ansible-documentation-incorrect-the-first-10-limit-boston-1-10-shouldnt-it-be-limit-boston-0-9/26629/1 "2018-02-01T21:49:06Z")

</div>

I’m seeing what appears to be two different definitions of how limits work. There is the first one here:

[http://docs.ansible.com/ansible/latest/playbooks\_best\_practices.html](http://docs.ansible.com/ansible/latest/playbooks_best_practices.html)

What about just the first 10, and then the next 10?:

```auto
ansible-playbook -i production webservers.yml --limit boston[1:10]
ansible-playbook -i production webservers.yml --limit boston[11:20]

```

Then there appears to be a different definition here:

[http://docs.ansible.com/ansible/latest/intro\_patterns.html](http://docs.ansible.com/ansible/latest/intro_patterns.html)

You can select a host or subset of hosts from a group by their position. For example, given the following group:

```auto
[webservers]
cobweb
webbing
weber

```

You can refer to hosts within the group by adding a subscript to the group name:

```auto
webservers[0] # == cobweb
webservers[-1] # == weber
webservers[0:1] # == webservers[0],webservers[1]
                    # == cobweb,webbing
webservers[1:] # == webbing,weber

```

Is it "–limit boston[1:2], or “–limit webservers[0:1]” for the first 2?

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [February 1, 2018, 10:06pm UTC](https://forum.ansible.com/t/is-the-following-ansible-documentation-incorrect-the-first-10-limit-boston-1-10-shouldnt-it-be-limit-boston-0-9/26629/2 "2018-02-01T22:06:26Z")

</div>

> I'm seeing what appears to be two different definitions of how limits work.  
> There is the first one here:
> 
> [http://docs.ansible.com/ansible/latest/playbooks\_best\_practices.html](http://docs.ansible.com/ansible/latest/playbooks_best_practices.html)
> 
> What about just the first 10, and then the next 10?:
> 
> ansible-playbook -i production webservers.yml --limit boston[1:10]  
> ansible-playbook -i production webservers.yml --limit boston[11:20]

This is not correct so it a documentation bug.  
To make the statement correct it should be boston[0:9] and boston[10:19]

> Then there appears to be a different definition here:
> 
> [http://docs.ansible.com/ansible/latest/intro\_patterns.html](http://docs.ansible.com/ansible/latest/intro_patterns.html)
> 
> You can select a host or subset of hosts from a group by their position.  
> For example, given the following group:
> 
> [webservers]  
> cobweb  
> webbing  
> weber
> 
> You can refer to hosts within the group by adding a subscript to the group  
> name:
> 
> webservers[0] # == cobweb  
> webservers[-1] # == weber  
> webservers[0:1] # == webservers[0],webservers[1]  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# == cobweb,webbing  
> webservers[1:] # == webbing,weber

This is correct.

> Is it "--limit boston[1:2], or "--limit webservers[0:1]" for the first 2?

"--limit webservers[0:1]"

---

<div class="post-metadata">

**Author:** ![Mike\_Cavedon](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@Mike\_Cavedon](https://forum.ansible.com/u/Mike_Cavedon)\
**Post date:** [February 1, 2018, 10:38pm UTC](https://forum.ansible.com/t/is-the-following-ansible-documentation-incorrect-the-first-10-limit-boston-1-10-shouldnt-it-be-limit-boston-0-9/26629/3 "2018-02-01T22:38:42Z")

</div>

I entered a PR to correct the bug. thanks again

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [February 6, 2018, 3:27pm UTC](https://forum.ansible.com/t/is-the-following-ansible-documentation-incorrect-the-first-10-limit-boston-1-10-shouldnt-it-be-limit-boston-0-9/26629/4 "2018-02-06T15:27:11Z")

</div>

Also you have to distinguish between 'array slices' and 'name ranges':

i.e:

[webservers]  
one  
two  
three  
other[1:23]

So webservers[1:3] is a list slice, while other[12:21] is actually a  
range of host names
