# inventory variable range

**URL:** <https://forum.ansible.com/t/inventory-variable-range/14734>\
**Category:** Ansible Project\
**Created:** [March 9, 2014, 5:11am UTC](https://forum.ansible.com/t/inventory-variable-range/14734 "2014-03-09T05:11:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![senorsmile](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/senorsmile/32/9024_2.png) [@senorsmile](https://forum.ansible.com/u/senorsmile)\
**Post date:** [March 9, 2014, 5:11am UTC](https://forum.ansible.com/t/inventory-variable-range/14734/1 "2014-03-09T05:11:51Z")

</div>

I am not quite sure how to do this. E.g.

I have a group of hosts

> www[100:150]

and I need to assign their hostnames:

> ansible\_ssh\_host = www[100:150].example.com

obviously I can’t do the above (I did try though). I assume there needs to be some abstraction and some sort of yaml magic happening here.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [March 9, 2014, 3:57pm UTC](https://forum.ansible.com/t/inventory-variable-range/14734/2 "2014-03-09T15:57:09Z")

</div>

You can’t do this and need to set the variable on every host.
