forked from apache/openwhisk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
logs.yml
67 lines (64 loc) · 2.91 KB
/
logs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements; and to You under the Apache License, Version 2.0.
---
# This playbook is used for utilities around logs
- import_playbook: properties.yml
- hosts: ansible
tasks:
- name: remove "logs" folder
file: path="{{ openwhisk_home }}/logs" state=absent
- name: create "logs" folder
file: path="{{ openwhisk_home }}/logs" state=directory
- name: dump entity views
local_action: shell "{{ openwhisk_home }}/bin/wskadmin" db get whisks --docs --view whisks.v2.1.0/{{ item }} | tail -n +2 > "{{ openwhisk_home }}/logs/db-{{ item }}.log"
with_items:
- actions
- triggers
- rules
- packages
when: "'db' not in exclude_logs_from"
- name: dump activations and subjects database
local_action: shell "{{ openwhisk_home }}/bin/wskadmin" db get {{ item }} --docs | tail -n +2 > "{{ openwhisk_home }}/logs/db-{{ item }}.log"
with_items:
- activations
- subjects
when: "'db' not in exclude_logs_from"
- name: create "test reports" folder
file: path="{{ openwhisk_home }}/logs/test-reports" state=directory
- name: collect test reports
local_action: shell cp -r "{{ openwhisk_home }}/tests/build/{{ item }}" "{{ openwhisk_home }}/logs/test-reports/"
with_items:
- reports
- test-results
ignore_errors: true
when: "'tests' not in exclude_logs_from"
- name: create "perf reports" folder
file: path="{{ openwhisk_home }}/logs/perf-reports" state=directory
- name: collect perf logs
local_action: shell cp "{{ openwhisk_home }}/tests/performance/gatling_tests/build/gatling.log" "{{ openwhisk_home }}/logs/perf-reports/"
ignore_errors: true
- hosts: all:!ansible
serial: 1
tasks:
- name: init var docker_host_flag
set_fact:
docker_host_flag: ""
- name: set host flag when using docker remote API
set_fact:
docker_host_flag: "--host tcp://{{ ansible_host }}:{{ docker.port }}"
when: environmentInformation.type != "local"
- name: get all docker containers
local_action: shell docker {{ docker_host_flag }} ps -a --format="{% raw %}{{.Names}}{% endraw %}"
register: container_names
- name: get logs from all containers
local_action: shell docker {{ docker_host_flag }} logs {{ item }} > "{{ openwhisk_home }}/logs/{{ item }}.log" 2>&1; exit 0
with_items: "{{ container_names.stdout_lines | difference('whisk_docker_registry') }}"
when: "'docker' not in exclude_logs_from"
- name: workaround to make synchronize work
set_fact:
ansible_ssh_private_key_file: "{{ ansible_ssh_private_key_file }}"
when: ansible_ssh_private_key_file is defined
- name: fetch logs from all machines
synchronize: src="{{ whisk_logs_dir }}/" dest="{{ openwhisk_home }}/logs" mode=pull
when: "'machine' not in exclude_logs_from"
ignore_errors: true