Add opendaylight log collection
Change-Id: Idb4eaf8bd89473a761919dab14a02b0fa0cf8fc6
This commit is contained in:
parent
0c7c08c67d
commit
a8892ecc55
@ -28,6 +28,7 @@
|
||||
- rabbitmq
|
||||
- httpd
|
||||
- openvswitch
|
||||
- opendaylight
|
||||
- common
|
||||
- fetch-logs
|
||||
|
||||
|
33
ansible/logs/roles/opendaylight/tasks/main.yml
Normal file
33
ansible/logs/roles/opendaylight/tasks/main.yml
Normal file
@ -0,0 +1,33 @@
|
||||
---
|
||||
- name: Check that opendaylight is installed
|
||||
stat:
|
||||
path: /opt/opendaylight
|
||||
register: opendaylight_baremetal
|
||||
|
||||
- name: Check if opendaylight is containerized
|
||||
stat:
|
||||
path: /var/lib/config-data/puppet-generated/opendaylight
|
||||
register: opendaylight_container
|
||||
|
||||
- name: Set opendaylight log location (containerized)
|
||||
set_fact:
|
||||
opendaylight_logs: /var/log/containers/opendaylight
|
||||
when: opendaylight_container.stat.isdir is defined and opendaylight_container.stat.isdir
|
||||
|
||||
- name: Set opendaylight location (non-containerized)
|
||||
set_fact:
|
||||
opendaylight_logs: /opt/opendaylight/data/logs
|
||||
when: opendaylight_baremetal.stat.isdir is defined and opendaylight_baremetal.stat.isdir
|
||||
|
||||
- name: Check if log folder exists
|
||||
stat:
|
||||
path: "{{opendaylight_logs}}"
|
||||
register: logs_path
|
||||
|
||||
- name: Copy logs to directory on host
|
||||
synchronize:
|
||||
src: "{{opendaylight_logs}}"
|
||||
dest: /home/{{host_remote_user}}/{{ansible_hostname}}
|
||||
delegate_to: "{{ inventory_hostname }}"
|
||||
when: (opendaylight_baremetal or opendaylight_container) and logs_path.stat.isdir is defined and logs_path.stat.isdir
|
||||
|
Loading…
Reference in New Issue
Block a user