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