Zack Williams | 6f0d88e | 2018-01-13 23:04:02 -0700 | [diff] [blame] | 1 | --- |
Matteo Scandolo | 3896c47 | 2017-08-01 13:31:42 -0700 | [diff] [blame] | 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 | |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 16 | # head-diag/tasks/main.yml |
| 17 | |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 18 | - name: Create diag_dir subdirs |
| 19 | file: |
Zack Williams | 6f0d88e | 2018-01-13 23:04:02 -0700 | [diff] [blame] | 20 | dest: "~/{{ diag_dir }}/{{ item }}" |
| 21 | state: directory |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 22 | with_items: |
Zack Williams | dc4878f | 2016-07-26 14:50:30 -0700 | [diff] [blame] | 23 | - head |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 24 | - juju |
| 25 | - openstack |
You Wang | 4089f8e | 2017-11-16 13:31:02 -0800 | [diff] [blame] | 26 | - onos-cord |
| 27 | - onos-fabric |
Zack Williams | 682450e | 2016-11-19 09:04:41 -0700 | [diff] [blame] | 28 | - docker |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 29 | |
Zack Williams | dc4878f | 2016-07-26 14:50:30 -0700 | [diff] [blame] | 30 | - name: Head node diag collection |
| 31 | shell: "{{ item }} > ~/{{ diag_dir }}/head/{{ item | regex_replace('[^\\w-]', '_')}}" |
Zack Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 32 | ignore_errors: yes |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 33 | args: |
| 34 | creates: "~/{{ diag_dir }}/head/{{ item | regex_replace('[^\\w-]', '_')}}" |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 35 | with_items: |
Zack Williams | cb52e5b | 2016-06-13 11:25:29 -0700 | [diff] [blame] | 36 | - "arp -n" |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 37 | - "brctl show" |
Zack Williams | dc4878f | 2016-07-26 14:50:30 -0700 | [diff] [blame] | 38 | - "cat /etc/lsb-release" |
Zack Williams | 6f0d88e | 2018-01-13 23:04:02 -0700 | [diff] [blame] | 39 | - "cat /etc/resolv.conf" |
| 40 | - "date -u" |
| 41 | - "df -k" |
| 42 | - "free" |
| 43 | - "ifconfig -a" |
| 44 | - "ip addr list" |
| 45 | - "ip link list" |
| 46 | - "ip neighbor" |
| 47 | - "ip route" |
| 48 | - "ps aux" |
| 49 | - "route -n" |
Zack Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 50 | - "sudo docker ps -a" |
Zack Williams | 6f0d88e | 2018-01-13 23:04:02 -0700 | [diff] [blame] | 51 | - "sudo iptables -S" |
| 52 | - "sudo iptables -t nat -S" |
| 53 | - "sudo lxc list" |
| 54 | - "sudo virsh list" |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 55 | |
| 56 | - name: Juju diag collection |
Zack Williams | 0410673 | 2016-06-27 20:55:32 -0700 | [diff] [blame] | 57 | shell: "{{ item }} > ~/{{ diag_dir }}/juju/{{ item | regex_replace('[^\\w-]', '_')}}" |
Zack Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 58 | ignore_errors: yes |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 59 | args: |
| 60 | creates: "~/{{ diag_dir }}/juju/{{ item | regex_replace('[^\\w-]', '_')}}" |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 61 | with_items: |
| 62 | - "juju status --format=summary" |
Zack Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 63 | - "juju status --format=tabular" |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 64 | - "juju status --format=json" |
| 65 | |
| 66 | - name: OpenStack diag collection |
Zack Williams | c989f26 | 2017-05-11 13:02:59 -0700 | [diff] [blame] | 67 | 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] | 68 | ignore_errors: yes |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 69 | args: |
| 70 | executable: "/bin/bash" |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 71 | creates: "~/{{ diag_dir }}/openstack/{{ item | regex_replace('[^\\w-]', '_')}}" |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 72 | with_items: |
Zack Williams | a653646 | 2016-06-13 13:13:33 -0700 | [diff] [blame] | 73 | - "glance image-list" |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 74 | - "nova list --all-tenants" |
Zack Williams | 85fd304 | 2016-06-13 13:47:58 -0700 | [diff] [blame] | 75 | - "nova host-list" |
Zack Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 76 | - "nova hypervisor-list" |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 77 | - "keystone tenant-list" |
Zack Williams | a653646 | 2016-06-13 13:13:33 -0700 | [diff] [blame] | 78 | - "keystone user-list" |
| 79 | - "neutron net-list" |
| 80 | - "neutron subnet-list" |
Zack Williams | 85fd304 | 2016-06-13 13:47:58 -0700 | [diff] [blame] | 81 | - "neutron port-list" |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 82 | |
You Wang | 4089f8e | 2017-11-16 13:31:02 -0800 | [diff] [blame] | 83 | - name: ONOS-CORD diag collection - REST API |
| 84 | 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] | 85 | ignore_errors: yes |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 86 | args: |
You Wang | 4089f8e | 2017-11-16 13:31:02 -0800 | [diff] [blame] | 87 | creates: "~/{{ diag_dir }}/onos-cord/rest_{{ item | regex_replace('[^\\w-]', '_')}}" |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 88 | 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] | 89 | with_items: |
| 90 | - "hosts" |
| 91 | |
You Wang | 4089f8e | 2017-11-16 13:31:02 -0800 | [diff] [blame] | 92 | - name: ONOS-CORD diag collection - ONOS CLI |
| 93 | 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] | 94 | ignore_errors: yes |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 95 | args: |
You Wang | 4089f8e | 2017-11-16 13:31:02 -0800 | [diff] [blame] | 96 | creates: "~/{{ diag_dir }}/onos-cord/{{ item | regex_replace('[^\\w-]', '_')}}" |
Zack Williams | 4e5d1d2 | 2016-06-13 11:10:03 -0700 | [diff] [blame] | 97 | with_items: |
Zack Williams | ae17c50 | 2016-06-28 22:05:19 -0700 | [diff] [blame] | 98 | - "apps -s -a" |
| 99 | - "bundle:list" |
Zack Williams | 97bbf0b | 2017-08-01 22:50:08 -0700 | [diff] [blame] | 100 | - "cordvtn-node-check compute1" |
Zack Williams | ae17c50 | 2016-06-28 22:05:19 -0700 | [diff] [blame] | 101 | - "cordvtn-nodes" |
Zack Williams | 682450e | 2016-11-19 09:04:41 -0700 | [diff] [blame] | 102 | - "cordvtn-networks" |
| 103 | - "cordvtn-ports" |
Zack Williams | ba7af9e | 2016-06-27 17:21:09 -0700 | [diff] [blame] | 104 | - "dhcp-list" |
Zack Williams | 97bbf0b | 2017-08-01 22:50:08 -0700 | [diff] [blame] | 105 | - "devices" |
Zack Williams | ae17c50 | 2016-06-28 22:05:19 -0700 | [diff] [blame] | 106 | - "flows" |
| 107 | - "hosts" |
| 108 | - "log:display" |
| 109 | - "nodes" |
Zack Williams | 97bbf0b | 2017-08-01 22:50:08 -0700 | [diff] [blame] | 110 | - "netcfg" |
Zack Williams | ae17c50 | 2016-06-28 22:05:19 -0700 | [diff] [blame] | 111 | - "ports" |
| 112 | - "summary" |
Zack Williams | 4e5d1d2 | 2016-06-13 11:10:03 -0700 | [diff] [blame] | 113 | |
You Wang | 4089f8e | 2017-11-16 13:31:02 -0800 | [diff] [blame] | 114 | - name: ONOS-FABRIC diag collection - REST API |
| 115 | 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 | 23f8622 | 2017-11-14 17:12:10 -0800 | [diff] [blame] | 116 | ignore_errors: yes |
| 117 | args: |
You Wang | 4089f8e | 2017-11-16 13:31:02 -0800 | [diff] [blame] | 118 | creates: "~/{{ diag_dir }}/onos-fabric/rest_{{ item | regex_replace('[^\\w-]', '_')}}" |
Suchitra Vemuri | 23f8622 | 2017-11-14 17:12:10 -0800 | [diff] [blame] | 119 | warn: False # get_url or uri can't easily redirect to a file |
| 120 | with_items: |
| 121 | - "hosts" |
| 122 | |
You Wang | 4089f8e | 2017-11-16 13:31:02 -0800 | [diff] [blame] | 123 | - name: ONOS-FABRIC diag collection - ONOS CLI |
| 124 | shell: "sshpass -p 'karaf' ssh -p 8101 karaf@onos-fabric {{ item }} > ~/{{ diag_dir }}/onos-fabric/{{ item | regex_replace('[^\\w-]', '_') }}" |
Suchitra Vemuri | 23f8622 | 2017-11-14 17:12:10 -0800 | [diff] [blame] | 125 | ignore_errors: yes |
| 126 | args: |
You Wang | 4089f8e | 2017-11-16 13:31:02 -0800 | [diff] [blame] | 127 | creates: "~/{{ diag_dir }}/onos-fabric/{{ item | regex_replace('[^\\w-]', '_')}}" |
Suchitra Vemuri | 23f8622 | 2017-11-14 17:12:10 -0800 | [diff] [blame] | 128 | with_items: |
| 129 | - "apps -s -a" |
| 130 | - "bundle:list" |
You Wang | 4089f8e | 2017-11-16 13:31:02 -0800 | [diff] [blame] | 131 | - "devices" |
| 132 | - "flows" |
Suchitra Vemuri | 23f8622 | 2017-11-14 17:12:10 -0800 | [diff] [blame] | 133 | - "hosts" |
| 134 | - "log:display" |
You Wang | 4089f8e | 2017-11-16 13:31:02 -0800 | [diff] [blame] | 135 | - "nodes" |
Suchitra Vemuri | 23f8622 | 2017-11-14 17:12:10 -0800 | [diff] [blame] | 136 | - "netcfg" |
| 137 | - "ports" |
| 138 | - "summary" |
Suchitra Vemuri | 15b55fc | 2018-01-31 14:52:37 -0800 | [diff] [blame] | 139 | - "links" |
| 140 | - "sr-ecmp-spg" |
| 141 | - "sr-next-hops" |
Suchitra Vemuri | 23f8622 | 2017-11-14 17:12:10 -0800 | [diff] [blame] | 142 | |
Zack Williams | 682450e | 2016-11-19 09:04:41 -0700 | [diff] [blame] | 143 | - name: Docker diag collection - Find names for all running Docker containers |
Zack Williams | 6f0d88e | 2018-01-13 23:04:02 -0700 | [diff] [blame] | 144 | command: sudo docker ps -a --format '{{'{{'}} .Names {{'}}'}}' |
Zack Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 145 | ignore_errors: yes |
Zack Williams | 682450e | 2016-11-19 09:04:41 -0700 | [diff] [blame] | 146 | register: docker_containers |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 147 | tags: |
Zack Williams | 682450e | 2016-11-19 09:04:41 -0700 | [diff] [blame] | 148 | - skip_ansible_lint # collecting docker container names |
| 149 | |
| 150 | - name: Docker diag collection - Collect logs from Docker containers |
Zack Williams | 6f0d88e | 2018-01-13 23:04:02 -0700 | [diff] [blame] | 151 | shell: "sudo docker logs {{ item }} > ~/{{ diag_dir }}/docker/{{ item | regex_replace('[^\\w-]', '_')}}.logs 2>&1" |
Zack Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 152 | ignore_errors: yes |
Zack Williams | 682450e | 2016-11-19 09:04:41 -0700 | [diff] [blame] | 153 | args: |
Zack Williams | 6f0d88e | 2018-01-13 23:04:02 -0700 | [diff] [blame] | 154 | creates: "~/{{ diag_dir }}/docker/{{ item | regex_replace('[^\\w-]', '_')}}.logs" |
Zack Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 155 | with_items: "{{ docker_containers.stdout_lines }}" |
Zack Williams | 682450e | 2016-11-19 09:04:41 -0700 | [diff] [blame] | 156 | tags: |
| 157 | - skip_ansible_lint # ansible-lint interprets the \n incorrectly |
| 158 | |
Zack Williams | 6f0d88e | 2018-01-13 23:04:02 -0700 | [diff] [blame] | 159 | - name: Docker diag collection - inspect Docker containers |
| 160 | shell: "sudo docker inspect {{ item }} > ~/{{ diag_dir }}/docker/{{ item | regex_replace('[^\\w-]', '_')}}.inspect 2>&1" |
| 161 | ignore_errors: yes |
| 162 | args: |
| 163 | creates: "~/{{ diag_dir }}/docker/{{ item | regex_replace('[^\\w-]', '_')}}.inspect" |
| 164 | with_items: "{{ docker_containers.stdout_lines }}" |
| 165 | tags: |
| 166 | - skip_ansible_lint # ansible-lint interprets the \n incorrectly |
| 167 | |
| 168 | # much cleaner to use !unsafe to avoid j2 parsing of golang {{ and }} templates |
| 169 | # but ansible-lint doesn't support it: https://github.com/willthames/ansible-lint/issues/291 |
| 170 | - name: Docker diag collection - Collect memory and CPU stats from docker containers |
| 171 | shell: "sudo docker stats --no-stream --format \"table {{'{{'}}.Name{{'}}'}}\t{{'{{'}}.Container{{'}}'}}\t{{'{{'}}.CPUPerc{{'}}'}}\t{{'{{'}}.MemUsage{{'}}'}}\t{{'{{'}}.MemPerc{{'}}'}}\" > ~/{{ diag_dir }}/docker/stats 2>&1" |
| 172 | ignore_errors: yes |
| 173 | args: |
| 174 | creates: "~/{{ diag_dir }}/docker/stats" |
| 175 | |