December 2018
Intermediate to advanced
226 pages
4h 57m
English
In this example, we will see how to use an Ansible playbook to ping multiple IPs and identify the particular IPs from hosts that fail the ping command (ping is not reachable to those IPs from the routers):
-sh-4.2$ more checklist.yml- name: Run ping commands hosts: all gather_facts: false remote_user: abhishek.ratan.adm connection: local no_log: True vars: publicips: { "dns1": "4.2.2.2", "dns2": "8.8.8.8", "dns3": "1.1.1.1", "dns4": "8.8.8.4", } tasks: - name: run ping to every other host ios_command: commands: ping "{{ item.value }}" repeat 1 #: item.key != inventory_hostname with_dict: "{{ publicips }}" register: trace_result # - name: Debug registered variables # debug: var=trace_result - name: Check ...Read now
Unlock full access