# \`ansible\_host\` parameter doesn't apply to some host

**URL:** <https://forum.ansible.com/t/ansible-host-parameter-doesnt-apply-to-some-host/19485>\
**Category:** Ansible Project\
**Created:** [October 12, 2015, 5:15am UTC](https://forum.ansible.com/t/ansible-host-parameter-doesnt-apply-to-some-host/19485 "2015-10-12T05:15:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wee\_Sritippho](https://avatars.discourse-cdn.com/v4/letter/w/eb8c5e/32.png) [@Wee\_Sritippho](https://forum.ansible.com/u/Wee_Sritippho)\
**Post date:** [October 12, 2015, 5:15am UTC](https://forum.ansible.com/t/ansible-host-parameter-doesnt-apply-to-some-host/19485/1 "2015-10-12T05:15:34Z")

</div>

I’m reading the [inventory document](http://docs.ansible.com/ansible/intro_inventory.html#hosts-and-groups) but can’t follow this example:

> Suppose you have just static IPs and want to set up some aliases that live in your host file, or you are connecting through tunnels. You can also describe hosts like this:
> 
> ```auto
>  
> 
> ```

> ```auto
> jumper ansible_port=5555 ansible_host=192.168.1.50
> 
> ```

Here is my _/etc/ansible/hosts_ file:

> vm1 ansible\_host=localhost ansible\_connection=local  
> vm2 ansible\_host=192.168.104.102

When I tried to ping every host, I got this error message for **vm2** :

> **vagrant@vm1:~$** ansible all -m ping  
> vm2 | FAILED =\> SSH Error: ssh: Could not resolve hostname vm2: Name or service not known  
> It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue.  
> vm1 | success \>\> {  
> “changed”: false,  
> “ping”: “pong”  
> }

> 

How can I set an alias for static IP 192.168.104.102 ?

---

<div class="post-metadata">

**Author:** ![Markus\_Ellers](https://avatars.discourse-cdn.com/v4/letter/m/35a633/32.png) [@Markus\_Ellers](https://forum.ansible.com/u/Markus_Ellers)\
**Post date:** [October 12, 2015, 5:04pm UTC](https://forum.ansible.com/t/ansible-host-parameter-doesnt-apply-to-some-host/19485/2 "2015-10-12T17:04:05Z")

</div>

Try using ansible\_ssh\_host instead:

vm2 ansible\_ssh\_host=192.168.104.102

---

<div class="post-metadata">

**Author:** ![Wee\_Sritippho](https://avatars.discourse-cdn.com/v4/letter/w/eb8c5e/32.png) [@Wee\_Sritippho](https://forum.ansible.com/u/Wee_Sritippho)\
**Post date:** [October 14, 2015, 6:11am UTC](https://forum.ansible.com/t/ansible-host-parameter-doesnt-apply-to-some-host/19485/3 "2015-10-14T06:11:45Z")

</div>

Thanks! ansible\_ssh\_host works.

เมื่อ วันอังคารที่ 13 ตุลาคม ค.ศ. 2015 0 นาฬิกา 04 นาที 05 วินาที UTC+7, Markus Ellers เขียนว่า:
