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
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]
Then there appears to be a different definition here:
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]
# == cobweb,webbing
webservers[1:] # == webbing,weber
Is it "–limit boston[1:2], or “–limit webservers[0:1]” for the first 2?
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
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
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]
# == 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]"
I entered a PR to correct the bug. thanks again
system
(system)
4
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