Add ability to collect sosreport logs

- RFE from tripleo-collect-logs issue #6[1]

[1] - https://github.com/redhat-openstack/ansible-role-tripleo-collect-logs/issues/6

Change-Id: I32d7c0063d8576ce331989c4bcd2f3583ac394cc
This commit is contained in:
Harry Rybacki 2016-10-14 10:09:26 -04:00
parent ca0166a92e
commit 59937252aa
3 changed files with 22 additions and 0 deletions

View File

@ -93,6 +93,8 @@ artcl_create_docs_payload:
remove the uploaded objects, the default is 2678400 seconds = 31 days.
* `artcl_artifact_url` -- a HTTP URL at which the uploaded logs will be
accessible after upload.
* `artcl_collect_sosreport` -- true/false -- If true, create and collect a
sosreport for each host.
Example Playbook
----------------
@ -122,6 +124,14 @@ has several simple rules:
`## ` removed. This is how and where general rST formatting is added.
5. All other lines, including shell comments, will be indented by four spaces.
Enabling sosreport Collection
-----------------------------
[sosreport](https://github.com/sosreport/sos) is a unified tool for collecting
system logs and other debug information. To enable creation of sosreport(s)
with this role, create a custom config (you can use centosci-logs.yml
as a template) and ensure that `artcl_collect_sosreport: true` is set.
License
-------

View File

@ -6,6 +6,7 @@ artcl_collect_list:
- /var/lib/mysql
- /var/lib/heat-config/heat-config-puppet/
- /var/lib/heat-config/heat-config-script/
- /var/tmp/sosreport*
- /etc/
- /home/stack/.instack/install-undercloud.log
- /home/stack/stackrc
@ -42,6 +43,8 @@ artcl_use_swift: false
artcl_swift_delete_after: 2678400
artcl_swift_container: logs
artcl_collect_sosreport: false
## Doc generation specific vars
artcl_gen_docs: false
artcl_docs_source_dir: "{{ local_working_dir }}/usr/local/share/ansible/roles/tripleo-collect-logs/docs/source"

View File

@ -125,6 +125,15 @@
set_fact:
oom_killer_problems_found: "{{ result.stdout_lines }}"
- name: Ensure sos package is installed when collect sosreport(s)
yum: name=sos state=present
when: artcl_collect_sosreport|bool
- name: Collect sosreport
command: >
sosreport --batch
when: artcl_collect_sosreport|bool
- name: Erase temporary log directory if exists
file:
path: "/tmp/{{ inventory_hostname }}"