December 2018
Intermediate to advanced
226 pages
4h 57m
English
This section focuses on the execution of the task on each of the hosts:
tasks:- name: run ping to every other host ios_command: commands: ping "{{ item.value }}" repeat 1 with_dict: "{{ publicips }}" register: trace_result
As a critical requirement, we need to ensure each host tries to ping all the given IPs to get the results. For this purpose, we iterate over all publicips with the with_dict command. With this command, we generate two values (item.key and item.value) that contain the values as dictionary items (item.key has names such as dns1 and dns2 and item.value has values such as 4.2.2.2 and 8.8.8.8).
Once we get the value, we use the IP address (item.value) to construct the ping command, which is passed ...
Read now
Unlock full access