ansible-role-collect-logs/tasks/collect/container.yml
Martin Kopec f1a45198a0 Run container collection in parallel
The task running the container collection is the longest taking
task. The patch makes this task running in parallel. The task
handles only containers therefore it's not in conflict with
any other collection task so running it in parallel is safe.

Change-Id: Ie61626667eebd3628525da38e911c5ef42da2f69
2020-06-23 18:26:55 +00:00

46 lines
1.5 KiB
YAML

---
- become: true
ignore_errors: true
block:
- name: check if ODL is enabled via docker
shell: docker ps | grep opendaylight_api
register: odl_container_enabled
- name: check if ODL is enabled via podman
shell: podman ps | grep opendaylight_api
register: odl_container_enabled
when: odl_container_enabled.rc != 0
- name: check if ODL is enabled via rpm
shell: rpm -qa | grep opendaylight
register: odl_rpm_enabled
- name: Create ODL log directory
file: dest="{{ odl_extra_log_dir }}" state=directory
when: (odl_rpm_enabled.rc == 0) or (odl_container_enabled.rc == 0)
- name: Collect OVS outputs for ODL
shell: "bash /tmp/odl_extra_logs.sh" # noqa 305
when: (odl_rpm_enabled.rc == 0) or (odl_container_enabled.rc == 0)
- name: Collect ODL info and logs (RPM deployment)
shell: >
cp /opt/opendaylight/data/log/* /var/log/extra/odl/;
journalctl -u opendaylight > /var/log/extra/odl/odl_journal.log
when: odl_rpm_enabled.rc == 0
- name: Copy collection logs script for containers
copy:
src: collect-container-logs.sh
dest: /tmp/collect-container-logs.sh
- name: Run container logs collection with timeout
command: >-
timeout --preserve-status -s 15 -k {{ (artcl_container_collect_timeout|int + 30)|string }}
{{ artcl_container_collect_timeout|string }} bash -x /tmp/collect-container-logs.sh
changed_when: true
async: 600
poll: 0
register: container_collection