# How to deal with "virtual" hostnames?

**URL:** <https://forum.ansible.com/t/how-to-deal-with-virtual-hostnames/33043>\
**Category:** Ansible Project\
**Created:** [May 28, 2020, 6:52pm UTC](https://forum.ansible.com/t/how-to-deal-with-virtual-hostnames/33043 "2020-05-28T18:52:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Toni\_Mueller](https://avatars.discourse-cdn.com/v4/letter/t/54ee81/32.png) [@Toni\_Mueller](https://forum.ansible.com/u/Toni_Mueller)\
**Post date:** [May 28, 2020, 6:52pm UTC](https://forum.ansible.com/t/how-to-deal-with-virtual-hostnames/33043/1 "2020-05-28T18:52:30Z")

</div>

Hi,

I would like to create a data structure which resembles a (virtual)  
host, but in a replicated fashion. Say, I have a number of nodes, and  
now I want to create the same "vhost" on a subset of them, for  
redundancy.

I'm having trouble expressing that in an inventory because only the  
nodes exist, but the "vhost" not (obviously?). For ease of use, I would  
rather not care about what or where the nodes actually are, but treat  
those "vhosts" as hosts with an attribute like "place on these nodes: 1,  
2, 3, ...".

If any given "vhost" would have to be placed on only one node, I'd just  
set the 'ansible\_host' variable accordingly.

What would be the best practice for this use case?

I am using Ansible 2.8 and 2.9, if that helps.

Thank you!

Cheers,  
Toni
