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