# varible hosts

**URL:** <https://forum.ansible.com/t/varible-hosts/29639>\
**Category:** Ansible Project\
**Created:** [February 8, 2019, 10:39am UTC](https://forum.ansible.com/t/varible-hosts/29639 "2019-02-08T10:39:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rupesh\_alasundkar](https://avatars.discourse-cdn.com/v4/letter/r/71e660/32.png) [@rupesh\_alasundkar](https://forum.ansible.com/u/rupesh_alasundkar)\
**Post date:** [February 8, 2019, 10:39am UTC](https://forum.ansible.com/t/varible-hosts/29639/1 "2019-02-08T10:39:55Z")

</div>

[1] peer{{ peer\_number }}.peers and [2]peer{{ peer\_number }}.peers.cluster{{ cluster }} are my 2 hosts.

NOTE: {{ peer\_number }} and {{ cluster }} is there any way i can use these both and can use in hosts: position???

my condition is

if i am passing ansible-playbook text.yml -e cluster=1 peer-number=1 [2] host will be in use. (( peer1.peers.cluster1 ))

if i am passing ansible-playbook text.yml -e cluster=0 peer-number=1 [1] host will be in use (( peer1.peers ))

bottom line is i want to use 2 varibles in hosts:

and want to pass only 2 argument i.e. {{ peer\_number }} & {{ cluster }}

thanks
