-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnewbackup.yml
91 lines (79 loc) · 2.36 KB
/
newbackup.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
---
- hosts: all
tasks:
- name: Performing backups using Cumulus config-backup
become: true
shell: /usr/cumulus/bin/config-backup
register: bkcfg
- debug:
msg: "Hello world {{ bkcfg.stdout.split(':')[2].split(' ')[3] }}"
- name: Fetch files to secure backup
become: true
fetch:
src: "{{ bkcfg.stdout.split(':')[2].split(' ')[3] }}"
dest: backup/{{ ansible_hostname }}/config/
flat: yes
- name: Backing up /etc/cumulus/ports.conf
fetch:
src: /etc/cumulus/ports.conf
dest: backup/{{ ansible_hostname }}/ports.conf
flat: yes
- name: Backing up /etc/network/interfaces
fetch:
src: /etc/network/interfaces
dest: backup/{{ ansible_hostname }}/interfaces
flat: yes
- name: Checking /etc/frr/daemons
become: true
stat:
path: /etc/frr/daemons
register: frr_daemons
- name: Backing up /etc/frr/daemons
when: frr_daemons.stat.exists == true
become: true
fetch:
src: /etc/frr/daemons
dest: backup/{{ ansible_hostname }}/daemons
flat: yes
ignore_errors: yes
- name: Checking for /etc/frr/frr.conf
become: true
stat:
path: /etc/frr/frr.conf
register: frr_conf
- debug:
msg: "Hello World {{ frr_conf }}"
- name: Backup /etc/frr/frr.conf
when: frr_conf.stat.exists == true
become: true
fetch:
src: /etc/frr/frr.conf
dest: backup/{{ ansible_hostname }}/frr.conf
flat: yes
ignore_errors: yes
- name: "Check if pam_radius config exists"
stat:
path: /etc/pam_radius_auth.conf
register: radius_conf
- name: "Check if snmpd config exists"
stat:
path: /etc/snmp/snmpd.conf
register: snmpd_conf
- name: "BACKUP RADIUS config"
when: radius_conf.stat.exists == true
fetch:
src: /etc/pam_radius_auth.conf
dest: backup/{{ansible_hostname}}/
flat: yes
- name: "BACKUP SNMPD config"
when: radius_conf.stat.exists == true
fetch:
src: /etc/pam_radius_auth.conf
dest: backup/{{ansible_hostname}}/
flat: yes
- name: Backing up Cumulus switches on 3.7
become: true
ansible.posix.synchronize:
src: /etc/
dest: backup/{{ansible_hostname}}/etc/
tags: sync