Ping all of your hosts in the cloud or on premises with an ansible playbook

Hits: 137

Today’s enterprises and small tech companies have multiple cloud instances as well as on premise bare metal. When you run ansible commands on these, you expect them to work. However, sometimes VMs and instances are not reachable.

 

To make sure that you have access to all of your hosts that exist in your /etc/ansible/hosts file run the following playbook. It tells the localhost to ping all of the lists hosts.

See the original source of this article that I wrote for Octopus Computer Solutions, where I work.

livehosts.yaml

- name: check reachable hosts
  hosts: all
  gather_facts: no
  tasks:
    - command: ping -c1 {{ inventory_hostname }}
      delegate_to: localhost
      register: ping_result
      ignore_errors: yes

Octopus Computer Solutions is a Red Hat business partner. We deploy OpenStack and OpenShift throughout Israel. 

 

Source: בלוגים – Ping all of your hosts in the cloud or on premises with an ansible playbook