-
Notifications
You must be signed in to change notification settings - Fork 1
/
os10-supportbundle.yml
executable file
·69 lines (61 loc) · 2.21 KB
/
os10-supportbundle.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
# Based on https://www.dell.com/support/kbdoc/en-us/000132936/how-to-generate-and-collect-support-bundle-in-dell-emc-networking-os10-switches
- hosts: switches
connection: network_cli
gather_facts: no
vars:
cleanup: true
generate: false
download: false
supportbundles: []
vars_files:
- vault.yml
tasks:
- name: "Generate Support Bundle"
dellemc.os10.os10_command:
commands: ['generate support-bundle enable-all-plugin-options']
when: generate
- name: "Waiting for 20 Minutes Support Bundle to Finish."
pause:
minutes: 20
when: generate
# ***This doesn't work when multiple bundles are generated. It will match on a previous BUNDLE_COMPLETED message in the log.
# - name: "Waiting for Support Bundle to Finish. *This can take up to 15 minutes"
# dellemc.os10.os10_command:
# commands:
# - show logging log-file
# interval: 15
# retries: 120 # 30 Minutes
# wait_for:
# - result[0] contains BUNDLE_COMPLETED
# when: generate
- name: "Get Support Bundles"
dellemc.os10.os10_command:
commands:
- dir supportbundle
register: out_supportbundle
- debug:
var: out_supportbundle
- name: "Create List of Bundle Names to Download"
set_fact:
supportbundles: "{{ supportbundles }} + [ '{{ item | trim | regex_search(regexp_extract) }}' ]"
vars:
regexp_extract: 'sosreport-(.+)'
regexp_match: 'sosreport-.*.tar.xz$'
loop: "{{ out_supportbundle.stdout_lines[0] }}"
when: item | trim | regex_search(regexp_match)
- debug:
var: supportbundles
- name: "Download Support Bundles"
dellemc.os10.os10_command:
commands:
- "copy supportbundle://{{ item }} scp://backup:[email protected]/mnt/data/backup/{{ item }}"
loop: "{{ supportbundles }}"
when: download
- name: "Remove Support Bundles"
dellemc.os10.os10_command:
commands:
- command: "delete supportbundle://{{ item }}*"
prompt: "Proceed to delete"
answer: "Yes"
loop: "{{ supportbundles }}"
when: cleanup