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 |
| 28 | - onos |
Zack Williams | 682450e | 2016-11-19 09:04:41 -0700 | [diff] [blame] | 29 | - docker |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 30 | |
Zack Williams | dc4878f | 2016-07-26 14:50:30 -0700 | [diff] [blame] | 31 | - name: Head node diag collection |
| 32 | shell: "{{ item }} > ~/{{ diag_dir }}/head/{{ item | regex_replace('[^\\w-]', '_')}}" |
Zack Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 33 | ignore_errors: yes |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 34 | args: |
| 35 | creates: "~/{{ diag_dir }}/head/{{ item | regex_replace('[^\\w-]', '_')}}" |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 36 | with_items: |
| 37 | - "ifconfig -a" |
| 38 | - "route -n" |
Zack Williams | cb52e5b | 2016-06-13 11:25:29 -0700 | [diff] [blame] | 39 | - "arp -n" |
Zack Williams | dc4878f | 2016-07-26 14:50:30 -0700 | [diff] [blame] | 40 | - "date" |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 41 | - "brctl show" |
| 42 | - "cat /etc/resolv.conf" |
Zack Williams | dc4878f | 2016-07-26 14:50:30 -0700 | [diff] [blame] | 43 | - "cat /etc/lsb-release" |
Zack Williams | 682450e | 2016-11-19 09:04:41 -0700 | [diff] [blame] | 44 | - "sudo virsh list" |
Zack Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 45 | - "sudo lxc list" |
| 46 | - "sudo docker ps -a" |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 47 | |
| 48 | - name: Juju diag collection |
Zack Williams | 0410673 | 2016-06-27 20:55:32 -0700 | [diff] [blame] | 49 | shell: "{{ item }} > ~/{{ diag_dir }}/juju/{{ item | regex_replace('[^\\w-]', '_')}}" |
Zack Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 50 | ignore_errors: yes |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 51 | args: |
| 52 | creates: "~/{{ diag_dir }}/juju/{{ item | regex_replace('[^\\w-]', '_')}}" |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 53 | with_items: |
| 54 | - "juju status --format=summary" |
Zack Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 55 | - "juju status --format=tabular" |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 56 | - "juju status --format=json" |
| 57 | |
| 58 | - name: OpenStack diag collection |
Zack Williams | c989f26 | 2017-05-11 13:02:59 -0700 | [diff] [blame] | 59 | 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] | 60 | ignore_errors: yes |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 61 | args: |
| 62 | executable: "/bin/bash" |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 63 | creates: "~/{{ diag_dir }}/openstack/{{ item | regex_replace('[^\\w-]', '_')}}" |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 64 | with_items: |
Zack Williams | a653646 | 2016-06-13 13:13:33 -0700 | [diff] [blame] | 65 | - "glance image-list" |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 66 | - "nova list --all-tenants" |
Zack Williams | 85fd304 | 2016-06-13 13:47:58 -0700 | [diff] [blame] | 67 | - "nova host-list" |
Zack Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 68 | - "nova hypervisor-list" |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 69 | - "keystone tenant-list" |
Zack Williams | a653646 | 2016-06-13 13:13:33 -0700 | [diff] [blame] | 70 | - "keystone user-list" |
| 71 | - "neutron net-list" |
| 72 | - "neutron subnet-list" |
Zack Williams | 85fd304 | 2016-06-13 13:47:58 -0700 | [diff] [blame] | 73 | - "neutron port-list" |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 74 | |
Zack Williams | 4e5d1d2 | 2016-06-13 11:10:03 -0700 | [diff] [blame] | 75 | - name: ONOS diag collection - REST API |
Zack Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 76 | 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 Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 78 | 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 Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 81 | with_items: |
| 82 | - "hosts" |
| 83 | |
Zack Williams | 4e5d1d2 | 2016-06-13 11:10:03 -0700 | [diff] [blame] | 84 | - name: ONOS diag collection - ONOS CLI |
Zack Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 85 | shell: "sshpass -p 'karaf' ssh -p 8102 karaf@onos-cord {{ item }} > ~/{{ diag_dir }}/onos/{{ item | regex_replace('[^\\w-]', '_') }}" |
| 86 | ignore_errors: yes |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 87 | args: |
| 88 | creates: "~/{{ diag_dir }}/onos/{{ item | regex_replace('[^\\w-]', '_')}}" |
Zack Williams | 4e5d1d2 | 2016-06-13 11:10:03 -0700 | [diff] [blame] | 89 | with_items: |
Zack Williams | ae17c50 | 2016-06-28 22:05:19 -0700 | [diff] [blame] | 90 | - "apps -s -a" |
| 91 | - "bundle:list" |
Zack Williams | 97bbf0b | 2017-08-01 22:50:08 -0700 | [diff] [blame] | 92 | - "cordvtn-node-check compute1" |
Zack Williams | ae17c50 | 2016-06-28 22:05:19 -0700 | [diff] [blame] | 93 | - "cordvtn-nodes" |
Zack Williams | 682450e | 2016-11-19 09:04:41 -0700 | [diff] [blame] | 94 | - "cordvtn-networks" |
| 95 | - "cordvtn-ports" |
Zack Williams | ba7af9e | 2016-06-27 17:21:09 -0700 | [diff] [blame] | 96 | - "dhcp-list" |
Zack Williams | 97bbf0b | 2017-08-01 22:50:08 -0700 | [diff] [blame] | 97 | - "devices" |
Zack Williams | ae17c50 | 2016-06-28 22:05:19 -0700 | [diff] [blame] | 98 | - "flows" |
| 99 | - "hosts" |
| 100 | - "log:display" |
| 101 | - "nodes" |
Zack Williams | 97bbf0b | 2017-08-01 22:50:08 -0700 | [diff] [blame] | 102 | - "netcfg" |
Zack Williams | ae17c50 | 2016-06-28 22:05:19 -0700 | [diff] [blame] | 103 | - "ports" |
| 104 | - "summary" |
Zack Williams | 4e5d1d2 | 2016-06-13 11:10:03 -0700 | [diff] [blame] | 105 | |
Zack Williams | 682450e | 2016-11-19 09:04:41 -0700 | [diff] [blame] | 106 | - name: Docker diag collection - Find names for all running Docker containers |
Zack Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 107 | command: sudo docker ps --format '{{'{{'}} .Names {{'}}'}}' |
| 108 | ignore_errors: yes |
Zack Williams | 682450e | 2016-11-19 09:04:41 -0700 | [diff] [blame] | 109 | register: docker_containers |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 110 | tags: |
Zack Williams | 682450e | 2016-11-19 09:04:41 -0700 | [diff] [blame] | 111 | - 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 Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 115 | ignore_errors: yes |
Zack Williams | 682450e | 2016-11-19 09:04:41 -0700 | [diff] [blame] | 116 | args: |
| 117 | creates: "~/{{ diag_dir }}/docker/{{ item | regex_replace('[^\\w-]', '_')}}" |
Zack Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 118 | with_items: "{{ docker_containers.stdout_lines }}" |
Zack Williams | 682450e | 2016-11-19 09:04:41 -0700 | [diff] [blame] | 119 | tags: |
| 120 | - skip_ansible_lint # ansible-lint interprets the \n incorrectly |
| 121 | |