diff options
author | Yifei Xue <xueyifei@huawei.com> | 2018-01-31 01:20:05 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2018-01-31 01:20:05 +0000 |
commit | bce23c34f221cdd9a41608c6505b359d99963afe (patch) | |
tree | 395fc2d49c8fd39305722cbcc1f84bb9572a173f /deploy/adapters/ansible/roles/config-osa/files | |
parent | e7f4a7321e549f88c461714dc0c9f24f925928e3 (diff) | |
parent | 68b619f36911eaf3deef8b8a3ec1ec655e86adf7 (diff) |
Merge "Collect log from rsyslog container"
Diffstat (limited to 'deploy/adapters/ansible/roles/config-osa/files')
-rwxr-xr-x | deploy/adapters/ansible/roles/config-osa/files/collect-log.sh | 17 | ||||
-rw-r--r-- | deploy/adapters/ansible/roles/config-osa/files/collect-log.yml | 32 |
2 files changed, 49 insertions, 0 deletions
diff --git a/deploy/adapters/ansible/roles/config-osa/files/collect-log.sh b/deploy/adapters/ansible/roles/config-osa/files/collect-log.sh new file mode 100755 index 00000000..7f51a2c3 --- /dev/null +++ b/deploy/adapters/ansible/roles/config-osa/files/collect-log.sh @@ -0,0 +1,17 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2018 HUAWEI TECHNOLOGIES CO.,LTD and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +set -o errexit +set -o nounset +set -o pipefail + +SCRIPT_PATH="$(dirname $(realpath ${BASH_SOURCE[0]}))" + +openstack-ansible $SCRIPT_PATH/collect-log.yml diff --git a/deploy/adapters/ansible/roles/config-osa/files/collect-log.yml b/deploy/adapters/ansible/roles/config-osa/files/collect-log.yml new file mode 100644 index 00000000..6e6f9e5a --- /dev/null +++ b/deploy/adapters/ansible/roles/config-osa/files/collect-log.yml @@ -0,0 +1,32 @@ +--- +############################################################################## +# Copyright (c) 2018 HUAWEI TECHNOLOGIES CO.,LTD and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +- name: Collect log + hosts: rsyslog[0] + user: root + tasks: + - name: ensure log directory exist + stat: + path: /var/log/log-storage + register: log_dir + + - name: compress log directory + archive: + path: "{{ log_dir.stat.path }}" + dest: "{{ log_dir.stat.path }}/log.tar.gz" + format: gz + when: log_dir.stat.exists is defined and log_dir.stat.exists + + - name: fetch the log tarball + fetch: + src: "{{ log_dir.stat.path }}/log.tar.gz" + dest: /opt/log.tar.gz + flat: "yes" + when: log_dir.stat.exists is defined and log_dir.stat.exists |