Matteo Scandolo | 3896c47 | 2017-08-01 13:31:42 -0700 | [diff] [blame] | 1 | |
| 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 Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 17 | --- |
| 18 | # head-diag/tasks/main.yml |
| 19 | |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 20 | - name: Create diag_dir subdirs |
| 21 | file: |
Zack Williams | 0410673 | 2016-06-27 20:55:32 -0700 | [diff] [blame] | 22 | dest="~/{{ diag_dir }}/{{ item }}" |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 23 | state=directory |
| 24 | with_items: |
Zack Williams | dc4878f | 2016-07-26 14:50:30 -0700 | [diff] [blame] | 25 | - head |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 26 | - juju |
| 27 | - openstack |
You Wang | 2877dd0 | 2017-11-16 13:31:02 -0800 | [diff] [blame] | 28 | - onos-cord |
| 29 | - onos-fabric |
Zack Williams | 682450e | 2016-11-19 09:04:41 -0700 | [diff] [blame] | 30 | - docker |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 31 | |
Zack Williams | dc4878f | 2016-07-26 14:50:30 -0700 | [diff] [blame] | 32 | - name: Head node diag collection |
| 33 | shell: "{{ item }} > ~/{{ diag_dir }}/head/{{ item | regex_replace('[^\\w-]', '_')}}" |
Zack Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 34 | ignore_errors: yes |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 35 | args: |
| 36 | creates: "~/{{ diag_dir }}/head/{{ item | regex_replace('[^\\w-]', '_')}}" |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 37 | with_items: |
| 38 | - "ifconfig -a" |
| 39 | - "route -n" |
Zack Williams | cb52e5b | 2016-06-13 11:25:29 -0700 | [diff] [blame] | 40 | - "arp -n" |
Zack Williams | dc4878f | 2016-07-26 14:50:30 -0700 | [diff] [blame] | 41 | - "date" |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 42 | - "brctl show" |
| 43 | - "cat /etc/resolv.conf" |
Zack Williams | dc4878f | 2016-07-26 14:50:30 -0700 | [diff] [blame] | 44 | - "cat /etc/lsb-release" |
Zack Williams | 682450e | 2016-11-19 09:04:41 -0700 | [diff] [blame] | 45 | - "sudo virsh list" |
Zack Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 46 | - "sudo lxc list" |
| 47 | - "sudo docker ps -a" |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 48 | |
| 49 | - name: Juju diag collection |
Zack Williams | 0410673 | 2016-06-27 20:55:32 -0700 | [diff] [blame] | 50 | shell: "{{ item }} > ~/{{ diag_dir }}/juju/{{ item | regex_replace('[^\\w-]', '_')}}" |
Zack Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 51 | ignore_errors: yes |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 52 | args: |
| 53 | creates: "~/{{ diag_dir }}/juju/{{ item | regex_replace('[^\\w-]', '_')}}" |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 54 | with_items: |
| 55 | - "juju status --format=summary" |
Zack Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 56 | - "juju status --format=tabular" |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 57 | - "juju status --format=json" |
| 58 | |
| 59 | - name: OpenStack diag collection |
Zack Williams | c989f26 | 2017-05-11 13:02:59 -0700 | [diff] [blame] | 60 | shell: "source /opt/cord_profile/admin-openrc.sh && {{ item }} > ~/{{ diag_dir }}/openstack/{{ item | regex_replace('[^\\w-]', '_')}}" |
Zack Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 61 | ignore_errors: yes |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 62 | args: |
| 63 | executable: "/bin/bash" |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 64 | creates: "~/{{ diag_dir }}/openstack/{{ item | regex_replace('[^\\w-]', '_')}}" |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 65 | with_items: |
Zack Williams | a653646 | 2016-06-13 13:13:33 -0700 | [diff] [blame] | 66 | - "glance image-list" |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 67 | - "nova list --all-tenants" |
Zack Williams | 85fd304 | 2016-06-13 13:47:58 -0700 | [diff] [blame] | 68 | - "nova host-list" |
Zack Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 69 | - "nova hypervisor-list" |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 70 | - "keystone tenant-list" |
Zack Williams | a653646 | 2016-06-13 13:13:33 -0700 | [diff] [blame] | 71 | - "keystone user-list" |
| 72 | - "neutron net-list" |
| 73 | - "neutron subnet-list" |
Zack Williams | 85fd304 | 2016-06-13 13:47:58 -0700 | [diff] [blame] | 74 | - "neutron port-list" |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 75 | |
You Wang | 2877dd0 | 2017-11-16 13:31:02 -0800 | [diff] [blame] | 76 | - 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 Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 78 | ignore_errors: yes |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 79 | args: |
You Wang | 2877dd0 | 2017-11-16 13:31:02 -0800 | [diff] [blame] | 80 | creates: "~/{{ diag_dir }}/onos-cord/rest_{{ item | regex_replace('[^\\w-]', '_')}}" |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 81 | warn: False # get_url or uri can't easily redirect to a file |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 82 | with_items: |
| 83 | - "hosts" |
| 84 | |
You Wang | 2877dd0 | 2017-11-16 13:31:02 -0800 | [diff] [blame] | 85 | - 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 Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 87 | ignore_errors: yes |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 88 | args: |
You Wang | 2877dd0 | 2017-11-16 13:31:02 -0800 | [diff] [blame] | 89 | creates: "~/{{ diag_dir }}/onos-cord/{{ item | regex_replace('[^\\w-]', '_')}}" |
Zack Williams | 4e5d1d2 | 2016-06-13 11:10:03 -0700 | [diff] [blame] | 90 | with_items: |
Zack Williams | ae17c50 | 2016-06-28 22:05:19 -0700 | [diff] [blame] | 91 | - "apps -s -a" |
| 92 | - "bundle:list" |
Zack Williams | 97bbf0b | 2017-08-01 22:50:08 -0700 | [diff] [blame] | 93 | - "cordvtn-node-check compute1" |
Zack Williams | ae17c50 | 2016-06-28 22:05:19 -0700 | [diff] [blame] | 94 | - "cordvtn-nodes" |
Zack Williams | 682450e | 2016-11-19 09:04:41 -0700 | [diff] [blame] | 95 | - "cordvtn-networks" |
| 96 | - "cordvtn-ports" |
Zack Williams | ba7af9e | 2016-06-27 17:21:09 -0700 | [diff] [blame] | 97 | - "dhcp-list" |
Zack Williams | 97bbf0b | 2017-08-01 22:50:08 -0700 | [diff] [blame] | 98 | - "devices" |
Zack Williams | ae17c50 | 2016-06-28 22:05:19 -0700 | [diff] [blame] | 99 | - "flows" |
| 100 | - "hosts" |
| 101 | - "log:display" |
| 102 | - "nodes" |
Zack Williams | 97bbf0b | 2017-08-01 22:50:08 -0700 | [diff] [blame] | 103 | - "netcfg" |
Zack Williams | ae17c50 | 2016-06-28 22:05:19 -0700 | [diff] [blame] | 104 | - "ports" |
| 105 | - "summary" |
Zack Williams | 4e5d1d2 | 2016-06-13 11:10:03 -0700 | [diff] [blame] | 106 | |
You Wang | 2877dd0 | 2017-11-16 13:31:02 -0800 | [diff] [blame] | 107 | - 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 Vemuri | d420e68 | 2017-11-14 17:12:10 -0800 | [diff] [blame] | 109 | ignore_errors: yes |
| 110 | args: |
You Wang | 2877dd0 | 2017-11-16 13:31:02 -0800 | [diff] [blame] | 111 | creates: "~/{{ diag_dir }}/onos-fabric/rest_{{ item | regex_replace('[^\\w-]', '_')}}" |
Suchitra Vemuri | d420e68 | 2017-11-14 17:12:10 -0800 | [diff] [blame] | 112 | warn: False # get_url or uri can't easily redirect to a file |
| 113 | with_items: |
| 114 | - "hosts" |
| 115 | |
You Wang | 2877dd0 | 2017-11-16 13:31:02 -0800 | [diff] [blame] | 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-]', '_') }}" |
Suchitra Vemuri | d420e68 | 2017-11-14 17:12:10 -0800 | [diff] [blame] | 118 | ignore_errors: yes |
| 119 | args: |
You Wang | 2877dd0 | 2017-11-16 13:31:02 -0800 | [diff] [blame] | 120 | creates: "~/{{ diag_dir }}/onos-fabric/{{ item | regex_replace('[^\\w-]', '_')}}" |
Suchitra Vemuri | d420e68 | 2017-11-14 17:12:10 -0800 | [diff] [blame] | 121 | with_items: |
| 122 | - "apps -s -a" |
| 123 | - "bundle:list" |
You Wang | 2877dd0 | 2017-11-16 13:31:02 -0800 | [diff] [blame] | 124 | - "devices" |
| 125 | - "flows" |
Suchitra Vemuri | d420e68 | 2017-11-14 17:12:10 -0800 | [diff] [blame] | 126 | - "hosts" |
| 127 | - "log:display" |
You Wang | 2877dd0 | 2017-11-16 13:31:02 -0800 | [diff] [blame] | 128 | - "nodes" |
Suchitra Vemuri | d420e68 | 2017-11-14 17:12:10 -0800 | [diff] [blame] | 129 | - "netcfg" |
| 130 | - "ports" |
| 131 | - "summary" |
| 132 | |
Zack Williams | 682450e | 2016-11-19 09:04:41 -0700 | [diff] [blame] | 133 | - name: Docker diag collection - Find names for all running Docker containers |
Zack Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 134 | command: sudo docker ps --format '{{'{{'}} .Names {{'}}'}}' |
| 135 | ignore_errors: yes |
Zack Williams | 682450e | 2016-11-19 09:04:41 -0700 | [diff] [blame] | 136 | register: docker_containers |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 137 | tags: |
Zack Williams | 682450e | 2016-11-19 09:04:41 -0700 | [diff] [blame] | 138 | - 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 Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 142 | ignore_errors: yes |
Zack Williams | 682450e | 2016-11-19 09:04:41 -0700 | [diff] [blame] | 143 | args: |
| 144 | creates: "~/{{ diag_dir }}/docker/{{ item | regex_replace('[^\\w-]', '_')}}" |
Zack Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 145 | with_items: "{{ docker_containers.stdout_lines }}" |
Zack Williams | 682450e | 2016-11-19 09:04:41 -0700 | [diff] [blame] | 146 | tags: |
| 147 | - skip_ansible_lint # ansible-lint interprets the \n incorrectly |
| 148 | |