blob: 7a920d5aebbc422a8c3d0b76339d51c92ca05bbe [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
Zack Williams682450e2016-11-19 09:04:41 -070029 - docker
Zack Williams2bfbbd62016-06-13 10:18:19 -070030
Zack Williamsdc4878f2016-07-26 14:50:30 -070031- name: Head node diag collection
32 shell: "{{ item }} > ~/{{ diag_dir }}/head/{{ item | regex_replace('[^\\w-]', '_')}}"
Zack Williams7bf35702017-02-08 20:40:02 -070033 ignore_errors: yes
Zack Williams35624562016-08-28 17:12:26 -070034 args:
35 creates: "~/{{ diag_dir }}/head/{{ item | regex_replace('[^\\w-]', '_')}}"
Zack Williams2bfbbd62016-06-13 10:18:19 -070036 with_items:
37 - "ifconfig -a"
38 - "route -n"
Zack Williamscb52e5b2016-06-13 11:25:29 -070039 - "arp -n"
Zack Williamsdc4878f2016-07-26 14:50:30 -070040 - "date"
Zack Williams2bfbbd62016-06-13 10:18:19 -070041 - "brctl show"
42 - "cat /etc/resolv.conf"
Zack Williamsdc4878f2016-07-26 14:50:30 -070043 - "cat /etc/lsb-release"
Zack Williams682450e2016-11-19 09:04:41 -070044 - "sudo virsh list"
Zack Williams7bf35702017-02-08 20:40:02 -070045 - "sudo lxc list"
46 - "sudo docker ps -a"
Zack Williams2bfbbd62016-06-13 10:18:19 -070047
48- name: Juju diag collection
Zack Williams04106732016-06-27 20:55:32 -070049 shell: "{{ item }} > ~/{{ diag_dir }}/juju/{{ item | regex_replace('[^\\w-]', '_')}}"
Zack Williams7bf35702017-02-08 20:40:02 -070050 ignore_errors: yes
Zack Williams35624562016-08-28 17:12:26 -070051 args:
52 creates: "~/{{ diag_dir }}/juju/{{ item | regex_replace('[^\\w-]', '_')}}"
Zack Williams2bfbbd62016-06-13 10:18:19 -070053 with_items:
54 - "juju status --format=summary"
Zack Williams7bf35702017-02-08 20:40:02 -070055 - "juju status --format=tabular"
Zack Williams2bfbbd62016-06-13 10:18:19 -070056 - "juju status --format=json"
57
58- name: OpenStack diag collection
Zack Williamsc989f262017-05-11 13:02:59 -070059 shell: "source /opt/cord_profile/admin-openrc.sh && {{ item }} > ~/{{ diag_dir }}/openstack/{{ item | regex_replace('[^\\w-]', '_')}}"
Zack Williams7bf35702017-02-08 20:40:02 -070060 ignore_errors: yes
Zack Williams2bfbbd62016-06-13 10:18:19 -070061 args:
62 executable: "/bin/bash"
Zack Williams35624562016-08-28 17:12:26 -070063 creates: "~/{{ diag_dir }}/openstack/{{ item | regex_replace('[^\\w-]', '_')}}"
Zack Williams2bfbbd62016-06-13 10:18:19 -070064 with_items:
Zack Williamsa6536462016-06-13 13:13:33 -070065 - "glance image-list"
Zack Williams2bfbbd62016-06-13 10:18:19 -070066 - "nova list --all-tenants"
Zack Williams85fd3042016-06-13 13:47:58 -070067 - "nova host-list"
Zack Williams7bf35702017-02-08 20:40:02 -070068 - "nova hypervisor-list"
Zack Williams2bfbbd62016-06-13 10:18:19 -070069 - "keystone tenant-list"
Zack Williamsa6536462016-06-13 13:13:33 -070070 - "keystone user-list"
71 - "neutron net-list"
72 - "neutron subnet-list"
Zack Williams85fd3042016-06-13 13:47:58 -070073 - "neutron port-list"
Zack Williams2bfbbd62016-06-13 10:18:19 -070074
Zack Williams4e5d1d22016-06-13 11:10:03 -070075- name: ONOS diag collection - REST API
Zack Williams7bf35702017-02-08 20:40:02 -070076 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-]', '_') }}"
77 ignore_errors: yes
Zack Williams35624562016-08-28 17:12:26 -070078 args:
79 creates: "~/{{ diag_dir }}/onos/rest_{{ item | regex_replace('[^\\w-]', '_')}}"
80 warn: False # get_url or uri can't easily redirect to a file
Zack Williams2bfbbd62016-06-13 10:18:19 -070081 with_items:
82 - "hosts"
83
Zack Williams4e5d1d22016-06-13 11:10:03 -070084- name: ONOS diag collection - ONOS CLI
Zack Williams7bf35702017-02-08 20:40:02 -070085 shell: "sshpass -p 'karaf' ssh -p 8102 karaf@onos-cord {{ item }} > ~/{{ diag_dir }}/onos/{{ item | regex_replace('[^\\w-]', '_') }}"
86 ignore_errors: yes
Zack Williams35624562016-08-28 17:12:26 -070087 args:
88 creates: "~/{{ diag_dir }}/onos/{{ item | regex_replace('[^\\w-]', '_')}}"
Zack Williams4e5d1d22016-06-13 11:10:03 -070089 with_items:
Zack Williamsae17c502016-06-28 22:05:19 -070090 - "apps -s -a"
91 - "bundle:list"
Zack Williams97bbf0b2017-08-01 22:50:08 -070092 - "cordvtn-node-check compute1"
Zack Williamsae17c502016-06-28 22:05:19 -070093 - "cordvtn-nodes"
Zack Williams682450e2016-11-19 09:04:41 -070094 - "cordvtn-networks"
95 - "cordvtn-ports"
Zack Williamsba7af9e2016-06-27 17:21:09 -070096 - "dhcp-list"
Zack Williams97bbf0b2017-08-01 22:50:08 -070097 - "devices"
Zack Williamsae17c502016-06-28 22:05:19 -070098 - "flows"
99 - "hosts"
100 - "log:display"
101 - "nodes"
Zack Williams97bbf0b2017-08-01 22:50:08 -0700102 - "netcfg"
Zack Williamsae17c502016-06-28 22:05:19 -0700103 - "ports"
104 - "summary"
Zack Williams4e5d1d22016-06-13 11:10:03 -0700105
Zack Williams682450e2016-11-19 09:04:41 -0700106- name: Docker diag collection - Find names for all running Docker containers
Zack Williams7bf35702017-02-08 20:40:02 -0700107 command: sudo docker ps --format '{{'{{'}} .Names {{'}}'}}'
108 ignore_errors: yes
Zack Williams682450e2016-11-19 09:04:41 -0700109 register: docker_containers
Zack Williams35624562016-08-28 17:12:26 -0700110 tags:
Zack Williams682450e2016-11-19 09:04:41 -0700111 - skip_ansible_lint # collecting docker container names
112
113- name: Docker diag collection - Collect logs from Docker containers
114 shell: "sudo docker logs {{ item }} > ~/{{ diag_dir }}/docker/{{ item | regex_replace('[^\\w-]', '_')}} 2>&1"
Zack Williams7bf35702017-02-08 20:40:02 -0700115 ignore_errors: yes
Zack Williams682450e2016-11-19 09:04:41 -0700116 args:
117 creates: "~/{{ diag_dir }}/docker/{{ item | regex_replace('[^\\w-]', '_')}}"
Zack Williams7bf35702017-02-08 20:40:02 -0700118 with_items: "{{ docker_containers.stdout_lines }}"
Zack Williams682450e2016-11-19 09:04:41 -0700119 tags:
120 - skip_ansible_lint # ansible-lint interprets the \n incorrectly
121