If you are not familiar dynamic inventory, check out Ansible - Getting Started with Dynamic Inventory.
This assumes you have the advanced_host_list plugin in ansible.cfg enabled, like this.
[inventory]
# enable inventory plugins, default: 'host_list', 'script', 'yaml', 'ini'
enable_plugins = advanced_host_list, yaml, ini
The ansible command with the --list-hosts and -vvv flags can be used to determine if the advanced_host_list plugin is being used.
AVOID TROUBLE
You must include the trailing comma after the managed node hostname
ansible all -i "server[1:10].example.com," --list-hosts -vvv
If you get something like this, this suggests you did not define advanced_host_list in ansible.cfg properly.
Unable to parse address from hostname, leaving unchanged: Detected range in host but was asked to ignore ranges
If the following is returned, the advanced_host_list plugin is being used.
Parsed server[1:10].example.com, inventory source with advanced_host_list plugin
Something like this should be returned.
hosts (10):
server1.example.com
server2.example.com
server3.example.com
server4.example.com
server5.example.com
server6.example.com
server7.example.com
server8.example.com
server9.example.com
server10.example.com
Or, the ansible-inventory command with the --list option can be used.
ansible-inventory -i "server[1:10].example.com," --list
Or, the ansible-inventory --list command can be used.
ansible-inventory -i "server[1:10].example.com," --list
Or, the ansible-inventory --graph command can be used.
ansible-inventory -i "server[1:10].example.com," --graph