diff --git a/roles/collect-logs/README.md b/roles/collect-logs/README.md index 1248b9354..1ad94026c 100644 --- a/roles/collect-logs/README.md +++ b/roles/collect-logs/README.md @@ -34,6 +34,9 @@ artcl_collect_list: - /home/stack/*.log - /var/log ``` +* `artcl_exclude_list` -- A list of files and directories to remove from + the collected logs. First of all we collect everything and then remove all + we have in `artcl_exclude_list` (`/etc/puppet/modules` by default). * `artcl_collect_dir` -- A local directory where the logs should be gathered, without a trailing slash. diff --git a/roles/collect-logs/defaults/main.yml b/roles/collect-logs/defaults/main.yml index b998ae2fc..adea44510 100644 --- a/roles/collect-logs/defaults/main.yml +++ b/roles/collect-logs/defaults/main.yml @@ -3,7 +3,6 @@ artcl_collect: true artcl_collect_list: - /var/log/ - - /var/lib/mysql - /var/lib/heat-config/heat-config-puppet/ - /var/lib/heat-config/heat-config-script/ - /var/tmp/sosreport* @@ -32,6 +31,13 @@ artcl_collect_list: - /home/stack/browbeat/results - /usr/share/openstack-tripleo-heat-templates - /tmp/tripleoclient* +artcl_exclude_list: + - /etc/udev/hwdb.bin + - /etc/puppet/modules + - /etc/project-config + - /etc/services + - /etc/selinux/targeted + - /etc/pki/ca-trust/extracted artcl_collect_dir: "{{ local_working_dir }}/collected_files" artcl_gzip_only: true artcl_tar_gz: false diff --git a/roles/collect-logs/tasks/collect.yml b/roles/collect-logs/tasks/collect.yml index e9527d487..06d5a8574 100644 --- a/roles/collect-logs/tasks/collect.yml +++ b/roles/collect-logs/tasks/collect.yml @@ -188,6 +188,9 @@ cp -rL --parents $F /tmp/{{ inventory_hostname }}; done; find /tmp/{{ inventory_hostname }} -not -type f -not -type d -delete; + for D in {{ artcl_exclude_list | default([]) | join(' ') }}; do + rm -rf "/tmp/{{ inventory_hostname }}/$D"; + done; find /tmp/{{ inventory_hostname }} -type d -print0 | xargs -0 chmod 755; find /tmp/{{ inventory_hostname }} -type f -print0 | xargs -0 chmod 644; chown -R {{ ansible_user }}: /tmp/{{ inventory_hostname }};