blob: c6d847d761285cd9b276504b9b6df1ff6910a9d1 [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
28 - onos
Suchitra Vemurid420e682017-11-14 17:12:10 -080029 - 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
Zack Williams4e5d1d22016-06-13 11:10:03 -070076- name: ONOS diag collection - REST API
Zack Williams7bf35702017-02-08 20:40:02 -070077 shell: "curl -X GET -u karaf:karaf http://onos-cord:8182/onos/v1/{{ item }} | python -m json.tool > ~/{{ diag_dir }}/onos/rest_{{ item | regex_replace('[^\\w-]', '_') }}"
78 ignore_errors: yes
Zack Williams35624562016-08-28 17:12:26 -070079 args:
80 creates: "~/{{ diag_dir }}/onos/rest_{{ item | regex_replace('[^\\w-]', '_')}}"
81 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
Zack Williams4e5d1d22016-06-13 11:10:03 -070085- name: ONOS diag collection - ONOS CLI
Zack Williams7bf35702017-02-08 20:40:02 -070086 shell: "sshpass -p 'karaf' ssh -p 8102 karaf@onos-cord {{ item }} > ~/{{ diag_dir }}/onos/{{ item | regex_replace('[^\\w-]', '_') }}"
87 ignore_errors: yes
Zack Williams35624562016-08-28 17:12:26 -070088 args:
89 creates: "~/{{ diag_dir }}/onos/{{ 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
Suchitra Vemurid420e682017-11-14 17:12:10 -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-]', '_') }}"
109 ignore_errors: yes
110 args:
111 creates: "~/{{ diag_dir }}/onos_fabric/rest_{{ item | regex_replace('[^\\w-]', '_')}}"
112 warn: False # get_url or uri can't easily redirect to a file
113 with_items:
114 - "hosts"
115
116- 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-]', '_') }}"
118 ignore_errors: yes
119 args:
120 creates: "~/{{ diag_dir }}/onos_fabric/{{ item | regex_replace('[^\\w-]', '_')}}"
121 with_items:
122 - "apps -s -a"
123 - "bundle:list"
124 - "hosts"
125 - "log:display"
126 - "netcfg"
127 - "ports"
128 - "summary"
129
Zack Williams682450e2016-11-19 09:04:41 -0700130- name: Docker diag collection - Find names for all running Docker containers
Zack Williams7bf35702017-02-08 20:40:02 -0700131 command: sudo docker ps --format '{{'{{'}} .Names {{'}}'}}'
132 ignore_errors: yes
Zack Williams682450e2016-11-19 09:04:41 -0700133 register: docker_containers
Zack Williams35624562016-08-28 17:12:26 -0700134 tags:
Zack Williams682450e2016-11-19 09:04:41 -0700135 - skip_ansible_lint # collecting docker container names
136
137- name: Docker diag collection - Collect logs from Docker containers
138 shell: "sudo docker logs {{ item }} > ~/{{ diag_dir }}/docker/{{ item | regex_replace('[^\\w-]', '_')}} 2>&1"
Zack Williams7bf35702017-02-08 20:40:02 -0700139 ignore_errors: yes
Zack Williams682450e2016-11-19 09:04:41 -0700140 args:
141 creates: "~/{{ diag_dir }}/docker/{{ item | regex_replace('[^\\w-]', '_')}}"
Zack Williams7bf35702017-02-08 20:40:02 -0700142 with_items: "{{ docker_containers.stdout_lines }}"
Zack Williams682450e2016-11-19 09:04:41 -0700143 tags:
144 - skip_ansible_lint # ansible-lint interprets the \n incorrectly
145