-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackup-to-git.yml
38 lines (34 loc) · 1.06 KB
/
backup-to-git.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
- name: LOCAL >> create child folders
file:
path: ".temp/{{ device_vendor }}/{{ inventory_hostname }}/"
state: directory
mode: 0755
- name: LOCAL >> aos6 copy configuration to local folder
copy:
content: "{{ remote_backup_config['output'] }}"
dest: ".temp/{{ device_vendor }}/{{ inventory_hostname }}/{{ ansible_host }}.cfg"
mode: 0644
when: device_os == 'aos6'
- name: LOCAL >> aos8 copy configuration to local folder
copy:
content: "{{ remote_backup_config.json['result']['output'] }}"
dest: ".temp/{{ device_vendor }}/{{ inventory_hostname }}/{{ ansible_host }}.cfg"
mode: 0644
when: device_os == 'aos8'
- name: GIT >> commit and push to remote
git_acp:
user: "{{ git_username }}"
token: "{{ git_token }}"
path: .temp/
branch: "{{ git_branch }}"
comment: Autobackup - net-awx
remote: origin
add: ["."]
mode: https
url: "https://git-ict.ap.be/netwerkbeheer/cmdb.git"
run_once: true
- name: LOCAL >> remove .temp directory (recursive)
file:
path: .temp
state: absent
run_once: true