blob: 182d1b639489aa56a6444a09d81752775afed720 [file] [log] [blame]
Matteo Scandolo3896c472017-08-01 13:31:42 -07001
2# Copyright 2017-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16
Zack Williams2bfbbd62016-06-13 10:18:19 -070017---
18# head-diag/tasks/main.yml
19
Zack Williams2bfbbd62016-06-13 10:18:19 -070020- name: Create diag_dir subdirs
21 file:
Zack Williams04106732016-06-27 20:55:32 -070022 dest="~/{{ diag_dir }}/{{ item }}"
Zack Williams2bfbbd62016-06-13 10:18:19 -070023 state=directory
24 with_items:
Zack Williamsdc4878f2016-07-26 14:50:30 -070025 - head
Zack Williams2bfbbd62016-06-13 10:18:19 -070026 - juju
27 - openstack
You Wang2877dd02017-11-16 13:31:02 -080028 - onos-cord
29 - onos-fabric
Zack Williams682450e2016-11-19 09:04:41 -070030 - docker
Zack Williams2bfbbd62016-06-13 10:18:19 -070031
Zack Williamsdc4878f2016-07-26 14:50:30 -070032- name: Head node diag collection
33 shell: "{{ item }} > ~/{{ diag_dir }}/head/{{ item | regex_replace('[^\\w-]', '_')}}"
Zack Williams7bf35702017-02-08 20:40:02 -070034 ignore_errors: yes
Zack Williams35624562016-08-28 17:12:26 -070035 args:
36 creates: "~/{{ diag_dir }}/head/{{ item | regex_replace('[^\\w-]', '_')}}"
Zack Williams2bfbbd62016-06-13 10:18:19 -070037 with_items:
38 - "ifconfig -a"
39 - "route -n"
Zack Williamscb52e5b2016-06-13 11:25:29 -070040 - "arp -n"
Zack Williamsdc4878f2016-07-26 14:50:30 -070041 - "date"
Zack Williams2bfbbd62016-06-13 10:18:19 -070042 - "brctl show"
43 - "cat /etc/resolv.conf"
Zack Williamsdc4878f2016-07-26 14:50:30 -070044 - "cat /etc/lsb-release"
Zack Williams682450e2016-11-19 09:04:41 -070045 - "sudo virsh list"
Zack Williams7bf35702017-02-08 20:40:02 -070046 - "sudo lxc list"
47 - "sudo docker ps -a"
Zack Williams2bfbbd62016-06-13 10:18:19 -070048
49- name: Juju diag collection
Zack Williams04106732016-06-27 20:55:32 -070050 shell: "{{ item }} > ~/{{ diag_dir }}/juju/{{ item | regex_replace('[^\\w-]', '_')}}"
Zack Williams7bf35702017-02-08 20:40:02 -070051 ignore_errors: yes
Zack Williams35624562016-08-28 17:12:26 -070052 args:
53 creates: "~/{{ diag_dir }}/juju/{{ item | regex_replace('[^\\w-]', '_')}}"
Zack Williams2bfbbd62016-06-13 10:18:19 -070054 with_items:
55 - "juju status --format=summary"
Zack Williams7bf35702017-02-08 20:40:02 -070056 - "juju status --format=tabular"
Zack Williams2bfbbd62016-06-13 10:18:19 -070057 - "juju status --format=json"
58
59- name: OpenStack diag collection
Zack Williamsc989f262017-05-11 13:02:59 -070060 shell: "source /opt/cord_profile/admin-openrc.sh && {{ item }} > ~/{{ diag_dir }}/openstack/{{ item | regex_replace('[^\\w-]', '_')}}"
Zack Williams7bf35702017-02-08 20:40:02 -070061 ignore_errors: yes
Zack Williams2bfbbd62016-06-13 10:18:19 -070062 args:
63 executable: "/bin/bash"
Zack Williams35624562016-08-28 17:12:26 -070064 creates: "~/{{ diag_dir }}/openstack/{{ item | regex_replace('[^\\w-]', '_')}}"
Zack Williams2bfbbd62016-06-13 10:18:19 -070065 with_items:
Zack Williamsa6536462016-06-13 13:13:33 -070066 - "glance image-list"
Zack Williams2bfbbd62016-06-13 10:18:19 -070067 - "nova list --all-tenants"
Zack Williams85fd3042016-06-13 13:47:58 -070068 - "nova host-list"
Zack Williams7bf35702017-02-08 20:40:02 -070069 - "nova hypervisor-list"
Zack Williams2bfbbd62016-06-13 10:18:19 -070070 - "keystone tenant-list"
Zack Williamsa6536462016-06-13 13:13:33 -070071 - "keystone user-list"
72 - "neutron net-list"
73 - "neutron subnet-list"
Zack Williams85fd3042016-06-13 13:47:58 -070074 - "neutron port-list"
Zack Williams2bfbbd62016-06-13 10:18:19 -070075
You Wang2877dd02017-11-16 13:31:02 -080076- name: ONOS-CORD diag collection - REST API
77 shell: "curl -X GET -u karaf:karaf http://onos-cord:8182/onos/v1/{{ item }} | python -m json.tool > ~/{{ diag_dir }}/onos-cord/rest_{{ item | regex_replace('[^\\w-]', '_') }}"
Zack Williams7bf35702017-02-08 20:40:02 -070078 ignore_errors: yes
Zack Williams35624562016-08-28 17:12:26 -070079 args:
You Wang2877dd02017-11-16 13:31:02 -080080 creates: "~/{{ diag_dir }}/onos-cord/rest_{{ item | regex_replace('[^\\w-]', '_')}}"
Zack Williams35624562016-08-28 17:12:26 -070081 warn: False # get_url or uri can't easily redirect to a file
Zack Williams2bfbbd62016-06-13 10:18:19 -070082 with_items:
83 - "hosts"
84
You Wang2877dd02017-11-16 13:31:02 -080085- name: ONOS-CORD diag collection - ONOS CLI
86 shell: "sshpass -p 'karaf' ssh -p 8102 karaf@onos-cord {{ item }} > ~/{{ diag_dir }}/onos-cord/{{ item | regex_replace('[^\\w-]', '_') }}"
Zack Williams7bf35702017-02-08 20:40:02 -070087 ignore_errors: yes
Zack Williams35624562016-08-28 17:12:26 -070088 args:
You Wang2877dd02017-11-16 13:31:02 -080089 creates: "~/{{ diag_dir }}/onos-cord/{{ item | regex_replace('[^\\w-]', '_')}}"
Zack Williams4e5d1d22016-06-13 11:10:03 -070090 with_items:
Zack Williamsae17c502016-06-28 22:05:19 -070091 - "apps -s -a"
92 - "bundle:list"
Zack Williams97bbf0b2017-08-01 22:50:08 -070093 - "cordvtn-node-check compute1"
Zack Williamsae17c502016-06-28 22:05:19 -070094 - "cordvtn-nodes"
Zack Williams682450e2016-11-19 09:04:41 -070095 - "cordvtn-networks"
96 - "cordvtn-ports"
Zack Williamsba7af9e2016-06-27 17:21:09 -070097 - "dhcp-list"
Zack Williams97bbf0b2017-08-01 22:50:08 -070098 - "devices"
Zack Williamsae17c502016-06-28 22:05:19 -070099 - "flows"
100 - "hosts"
101 - "log:display"
102 - "nodes"
Zack Williams97bbf0b2017-08-01 22:50:08 -0700103 - "netcfg"
Zack Williamsae17c502016-06-28 22:05:19 -0700104 - "ports"
105 - "summary"
Zack Williams4e5d1d22016-06-13 11:10:03 -0700106
You Wang2877dd02017-11-16 13:31:02 -0800107- name: ONOS-FABRIC diag collection - REST API
108 shell: "curl -X GET -u karaf:karaf http://onos-fabric:8182/onos/v1/{{ item }} | python -m json.tool > ~/{{ diag_dir }}/onos-fabric/rest_{{ item | regex_replace('[^\\w-]', '_') }}"
Suchitra Vemurid420e682017-11-14 17:12:10 -0800109 ignore_errors: yes
110 args:
You Wang2877dd02017-11-16 13:31:02 -0800111 creates: "~/{{ diag_dir }}/onos-fabric/rest_{{ item | regex_replace('[^\\w-]', '_')}}"
Suchitra Vemurid420e682017-11-14 17:12:10 -0800112 warn: False # get_url or uri can't easily redirect to a file
113 with_items:
114 - "hosts"
115
You Wang2877dd02017-11-16 13:31:02 -0800116- name: ONOS-FABRIC diag collection - ONOS CLI
117 shell: "sshpass -p 'karaf' ssh -p 8101 karaf@onos-fabric {{ item }} > ~/{{ diag_dir }}/onos-fabric/{{ item | regex_replace('[^\\w-]', '_') }}"
Suchitra Vemurid420e682017-11-14 17:12:10 -0800118 ignore_errors: yes
119 args:
You Wang2877dd02017-11-16 13:31:02 -0800120 creates: "~/{{ diag_dir }}/onos-fabric/{{ item | regex_replace('[^\\w-]', '_')}}"
Suchitra Vemurid420e682017-11-14 17:12:10 -0800121 with_items:
122 - "apps -s -a"
123 - "bundle:list"
You Wang2877dd02017-11-16 13:31:02 -0800124 - "devices"
125 - "flows"
Suchitra Vemurid420e682017-11-14 17:12:10 -0800126 - "hosts"
127 - "log:display"
You Wang2877dd02017-11-16 13:31:02 -0800128 - "nodes"
Suchitra Vemurid420e682017-11-14 17:12:10 -0800129 - "netcfg"
130 - "ports"
131 - "summary"
132
Zack Williams682450e2016-11-19 09:04:41 -0700133- name: Docker diag collection - Find names for all running Docker containers
Zack Williams7bf35702017-02-08 20:40:02 -0700134 command: sudo docker ps --format '{{'{{'}} .Names {{'}}'}}'
135 ignore_errors: yes
Zack Williams682450e2016-11-19 09:04:41 -0700136 register: docker_containers
Zack Williams35624562016-08-28 17:12:26 -0700137 tags:
Zack Williams682450e2016-11-19 09:04:41 -0700138 - skip_ansible_lint # collecting docker container names
139
140- name: Docker diag collection - Collect logs from Docker containers
141 shell: "sudo docker logs {{ item }} > ~/{{ diag_dir }}/docker/{{ item | regex_replace('[^\\w-]', '_')}} 2>&1"
Zack Williams7bf35702017-02-08 20:40:02 -0700142 ignore_errors: yes
Zack Williams682450e2016-11-19 09:04:41 -0700143 args:
144 creates: "~/{{ diag_dir }}/docker/{{ item | regex_replace('[^\\w-]', '_')}}"
Zack Williams7bf35702017-02-08 20:40:02 -0700145 with_items: "{{ docker_containers.stdout_lines }}"
Zack Williams682450e2016-11-19 09:04:41 -0700146 tags:
147 - skip_ansible_lint # ansible-lint interprets the \n incorrectly
148