blob: cbec4447b8bea9fe7260a8c672315323d7fa2fa0 [file] [log] [blame]
Andrea Frittoli (andreaf)290d9d82017-12-11 14:30:59 +00001# NOTE(andreaf) This bypasses the stage-output role
2- name: Ensure {{ stage_dir }}/logs exists
3 become: true
4 file:
5 path: "{{ stage_dir }}/logs"
6 state: directory
7 owner: "{{ ansible_user }}"
8
Ian Wienand59ce1d92019-02-11 12:27:10 +11009- name: Export legacy stack screen log files
Monty Taylor36ddea32017-10-02 10:05:17 -050010 become: true
11 shell:
12 cmd: |
13 u=""
14 name=""
Ian Wienand59ce1d92019-02-11 12:27:10 +110015 for u in $(systemctl list-unit-files | grep devstack | awk '{print $1}'); do
Monty Taylor36ddea32017-10-02 10:05:17 -050016 name=$(echo $u | sed 's/devstack@/screen-/' | sed 's/\.service//')
Clark Boylan2700bf82018-01-04 10:16:16 -080017 journalctl -o short-precise --unit $u | gzip - > {{ stage_dir }}/logs/$name.txt.gz
Monty Taylor36ddea32017-10-02 10:05:17 -050018 done
19
Ian Wienand59ce1d92019-02-11 12:27:10 +110020- name: Export legacy syslog.txt
21 become: true
22 shell:
23 # The journal contains everything running under systemd, we'll
24 # build an old school version of the syslog with just the
25 # kernel and sudo messages.
26 cmd: |
Monty Taylor36ddea32017-10-02 10:05:17 -050027 journalctl \
28 -t kernel \
29 -t sudo \
30 --no-pager \
31 --since="$(cat {{ devstack_base_dir }}/log-start-timestamp.txt)" \
Clark Boylan2700bf82018-01-04 10:16:16 -080032 | gzip - > {{ stage_dir }}/logs/syslog.txt.gz
Ian Wienand59ce1d92019-02-11 12:27:10 +110033
34# TODO: convert this to ansible
35# - make a list of the above units
36# - iterate the list here
37- name: Export journal
38 become: true
39 shell:
40 # Export the journal in export format to make it downloadable
41 # for later searching. It can then be rewritten to a journal native
42 # format locally using systemd-journal-remote. This makes a class of
43 # debugging much easier. We don't do the native conversion here as
44 # some distros do not package that tooling.
45 cmd: |
46 journalctl -o export \
47 --since="$(cat {{ devstack_base_dir }}/log-start-timestamp.txt)" \
48 | xz --threads=0 - > {{ stage_dir }}/logs/devstack.journal.xz
49
50- name: Save journal README
51 become: true
52 template:
53 src: devstack.journal.README.txt.j2
54 dest: '{{ stage_dir }}/logs/devstack.journal.README.txt'