-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterfaces.yml
35 lines (30 loc) · 1.07 KB
/
interfaces.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
---
## Playbook to get ip arp info from Cisco switches
- hosts: localhost
gather_facts: False
tasks:
- name: Get Ansible date/time facts
setup:
filter: "ansible_date_time"
gather_subset: "!all"
- name: Store DTG as fact
set_fact:
DTG: "{{ ansible_date_time.date }}"
- name: Create Directory {{ hostvars.localhost.DTG }}
file:
path: "{{playbook_dir}}/Interfaces_{{hostvars.localhost.DTG}}"
mode: 0755
state: directory
- hosts: sw
connection: local
gather_facts: False
tasks:
- name: Show IP arp tables
ios_command:
commands:
- show ip arp
register: showIP
- name: Save output to Interface_{{hostvars.localhost.DTG}}
copy:
content: "{{showIP.stdout[0]}}\n"
dest: "{{playbook_dir}}/Interface_{{hostvars.localhost.DTG}}/{{inventory_hostname}}-{{hostvars.localhost.DTG}}-int.txt"