--- - name: Set Interface description based on CDP/LLDP discovery hosts: all gather_facts: yes connection: network_cli tasks: - name: Set IOS Interface Description ios_config: lines: - description Connected to {{ item.value[0].host }} via its {{ item.value[0].port }} parents: interface {{ item.key }} save_when: changed with_dict: "{{ansible_facts.net_neighbors }}" when: ansible_network_os == 'ios' - name: Set NXOS Interface Description nxos_config: lines: - description Connected to {{ item.value[0].host }} via its {{ item.value[0].port }} parents: interface {{ item.key }} save_when: changed with_dict: "{{ansible_facts.net_neighbors }}" when: ansible_network_os == 'nxos'