# what's the syntac in ansible playbook to ping a remote host

**URL:** <https://forum.ansible.com/t/whats-the-syntac-in-ansible-playbook-to-ping-a-remote-host/14864>\
**Category:** Ansible Project\
**Created:** [March 26, 2014, 7:45pm UTC](https://forum.ansible.com/t/whats-the-syntac-in-ansible-playbook-to-ping-a-remote-host/14864 "2014-03-26T19:45:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![YuLing\_Chen](https://avatars.discourse-cdn.com/v4/letter/y/4491bb/32.png) [@YuLing\_Chen](https://forum.ansible.com/u/YuLing_Chen)\
**Post date:** [March 26, 2014, 7:45pm UTC](https://forum.ansible.com/t/whats-the-syntac-in-ansible-playbook-to-ping-a-remote-host/14864/1 "2014-03-26T19:45:13Z")

</div>

Hi All,

I’m looking for the syntax to ping a remote host in ansible playbook. I created something as follows, but it seems the syntax is wrong.

- name: assign floating ip  
quantum\_floating\_ip:  
login\_username: ‘{{login\_username}}’  
login\_password: ‘{{login\_password}}’  
login\_tenant\_name: ‘{{project\_name}}’  
instance\_name: ‘{{instance\_name}}’  
network\_name: ext\_net  
internal\_network\_name: mgmt\_network  
register: v\_floating\_ip

- name: validate connectivity to the controller  
action: ping  
ip\_address: ‘{{v\_floating\_ip.public\_ip}}’

I got the floating ip from the previous step successfully. Now I just would like to ping the floating ip to make sure it’s accessible. Any idea how I would be able to do?

Thanks,

YuLing

---

<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 26, 2014, 11:39pm UTC](https://forum.ansible.com/t/whats-the-syntac-in-ansible-playbook-to-ping-a-remote-host/14864/2 "2014-03-26T23:39:19Z")

</div>

All you would need to do is just

- action: ping

The ping module will get called for the current host in the host loop automatically.

There isn’t a way to specify an ICMP ping though, that’s just a SSH connectivity test to the current host alias, as looked up by hostname.

What you may have to do is use the “add\_host” module to create a temporary host for the given floating IP, if you want to test it is accessible.
