---
- name: show interfaces
hosts: all
connection: network_cli
gather_facts: no
vars:
ansible_network_os: ios
my_list: []
tasks:
- name: show interfaces
ios_facts:
gather_subset: "interfaces"
- name: get interface
set_fact:
my_list: '{{my_list + [item]}}'
with_items: "{{ ansible_net_interfaces }}"
- debug:
var: my_list
- name: loop through
with_items: " {{ my_list }}"
ios_command:
commands: show run interface {{ item }}