Hi Team
I want get output of “show mac add int {{ item.key }}” as report for each interface, Can anyone guide me how to export the command output only matched condition as text file?
Playbook:
roles:
- ansible-network.network-engine
tasks:
- name: Collect switchport interface information
ios_command:
commands:
- show interface status
register: show_interface_status
- name: Parser the interface facts
command_parser:
file: “parser/ios/show_interface_status.yaml”
content: “{{ show_interface_status.stdout.0 }}”
- name: print the vlan 30 interface
ios_command:
commands:
- “show running interface {{ item.key }}”
when: item.value.data.vlan == ‘100’
with_dict: “{{ interfaces_status_facts }}”
register: vlan30_output
- name: print the vlan 30 interface
ios_command:
commands:
- “show mac add int {{ item.key }}”
when: item.value.data.vlan == ‘1’
with_dict: “{{ interfaces_status_facts }}”
register: vlan30_output