diff --git a/README.md b/README.md index 38aa1ed..9697eca 100644 --- a/README.md +++ b/README.md @@ -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 ------- diff --git a/defaults/main.yml b/defaults/main.yml index 93dd015..e47daca 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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" diff --git a/tasks/collect.yml b/tasks/collect.yml index 1173606..7d0cf9e 100644 --- a/tasks/collect.yml +++ b/tasks/collect.yml @@ -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 }}"