-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackup_config_tacacs.yml
35 lines (28 loc) · 998 Bytes
/
backup_config_tacacs.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
---
## Playbook to get system time and append it to backup files
- hosts: localhost
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: ~/workspaces/data/{{hostvars.localhost.DTG}}
state: directory
run_once: true
- hosts: core
tasks:
- name: Backup asr9k cores
cisco.iosxr.iosxr_command:
commands: show running-config
register: config
- name: Save output to ~/workspaces /data/cisco/
copy:
content: "{{config.stdout[0]}}"
dest: "~/workspaces/data/{{hostvars.localhost.DTG}}/cisco/{{inventory_hostname}}-{{hostvars.localhost.DTG}}-config.txt"
# content: "{{config.stdout}}"
# dest: "~/workspaces/data/{{hostvars.localhost.DTG}}/{{inventory_hostname}}-{{hostvars.localhost.DTG}}-config.txt"