blob: e73417b528b21c60e4098d3dbee19e573752def2 [file] [log] [blame]
Zack Williams2bfbbd62016-06-13 10:18:19 -07001---
2# head-diag/tasks/main.yml
3
Zack Williams2bfbbd62016-06-13 10:18:19 -07004- name: Create diag_dir subdirs
5 file:
Zack Williams04106732016-06-27 20:55:32 -07006 dest="~/{{ diag_dir }}/{{ item }}"
Zack Williams2bfbbd62016-06-13 10:18:19 -07007 state=directory
8 with_items:
Zack Williamsdc4878f2016-07-26 14:50:30 -07009 - head
Zack Williams2bfbbd62016-06-13 10:18:19 -070010 - juju
11 - openstack
12 - onos
Zack Williams682450e2016-11-19 09:04:41 -070013 - docker
Zack Williams2bfbbd62016-06-13 10:18:19 -070014
Zack Williamsdc4878f2016-07-26 14:50:30 -070015- name: Head node diag collection
16 shell: "{{ item }} > ~/{{ diag_dir }}/head/{{ item | regex_replace('[^\\w-]', '_')}}"
Zack Williams7bf35702017-02-08 20:40:02 -070017 ignore_errors: yes
Zack Williams35624562016-08-28 17:12:26 -070018 args:
19 creates: "~/{{ diag_dir }}/head/{{ item | regex_replace('[^\\w-]', '_')}}"
Zack Williams2bfbbd62016-06-13 10:18:19 -070020 with_items:
21 - "ifconfig -a"
22 - "route -n"
Zack Williamscb52e5b2016-06-13 11:25:29 -070023 - "arp -n"
Zack Williamsdc4878f2016-07-26 14:50:30 -070024 - "date"
Zack Williams2bfbbd62016-06-13 10:18:19 -070025 - "brctl show"
26 - "cat /etc/resolv.conf"
Zack Williamsdc4878f2016-07-26 14:50:30 -070027 - "cat /etc/lsb-release"
Zack Williamscb52e5b2016-06-13 11:25:29 -070028 - "sudo uvt-kvm list"
Zack Williams682450e2016-11-19 09:04:41 -070029 - "sudo virsh list"
Zack Williams7bf35702017-02-08 20:40:02 -070030 - "sudo lxc list"
31 - "sudo docker ps -a"
Zack Williams2bfbbd62016-06-13 10:18:19 -070032
33- name: Juju diag collection
Zack Williams04106732016-06-27 20:55:32 -070034 shell: "{{ item }} > ~/{{ diag_dir }}/juju/{{ item | regex_replace('[^\\w-]', '_')}}"
Zack Williams7bf35702017-02-08 20:40:02 -070035 ignore_errors: yes
Zack Williams35624562016-08-28 17:12:26 -070036 args:
37 creates: "~/{{ diag_dir }}/juju/{{ item | regex_replace('[^\\w-]', '_')}}"
Zack Williams2bfbbd62016-06-13 10:18:19 -070038 with_items:
39 - "juju status --format=summary"
Zack Williams7bf35702017-02-08 20:40:02 -070040 - "juju status --format=tabular"
Zack Williams2bfbbd62016-06-13 10:18:19 -070041 - "juju status --format=json"
42
43- name: OpenStack diag collection
Zack Williams04106732016-06-27 20:55:32 -070044 shell: "source ~/admin-openrc.sh && {{ item }} > ~/{{ diag_dir }}/openstack/{{ item | regex_replace('[^\\w-]', '_')}}"
Zack Williams7bf35702017-02-08 20:40:02 -070045 ignore_errors: yes
Zack Williams2bfbbd62016-06-13 10:18:19 -070046 args:
47 executable: "/bin/bash"
Zack Williams35624562016-08-28 17:12:26 -070048 creates: "~/{{ diag_dir }}/openstack/{{ item | regex_replace('[^\\w-]', '_')}}"
Zack Williams2bfbbd62016-06-13 10:18:19 -070049 with_items:
Zack Williamsa6536462016-06-13 13:13:33 -070050 - "glance image-list"
Zack Williams2bfbbd62016-06-13 10:18:19 -070051 - "nova list --all-tenants"
Zack Williams85fd3042016-06-13 13:47:58 -070052 - "nova host-list"
Zack Williams7bf35702017-02-08 20:40:02 -070053 - "nova hypervisor-list"
Zack Williams2bfbbd62016-06-13 10:18:19 -070054 - "keystone tenant-list"
Zack Williamsa6536462016-06-13 13:13:33 -070055 - "keystone user-list"
56 - "neutron net-list"
57 - "neutron subnet-list"
Zack Williams85fd3042016-06-13 13:47:58 -070058 - "neutron port-list"
Zack Williams2bfbbd62016-06-13 10:18:19 -070059
Zack Williams4e5d1d22016-06-13 11:10:03 -070060- name: ONOS diag collection - REST API
Zack Williams7bf35702017-02-08 20:40:02 -070061 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 Williams35624562016-08-28 17:12:26 -070063 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 Williams2bfbbd62016-06-13 10:18:19 -070066 with_items:
67 - "hosts"
68
Zack Williams4e5d1d22016-06-13 11:10:03 -070069- name: ONOS diag collection - ONOS CLI
Zack Williams7bf35702017-02-08 20:40:02 -070070 shell: "sshpass -p 'karaf' ssh -p 8102 karaf@onos-cord {{ item }} > ~/{{ diag_dir }}/onos/{{ item | regex_replace('[^\\w-]', '_') }}"
71 ignore_errors: yes
Zack Williams35624562016-08-28 17:12:26 -070072 args:
73 creates: "~/{{ diag_dir }}/onos/{{ item | regex_replace('[^\\w-]', '_')}}"
Zack Williams4e5d1d22016-06-13 11:10:03 -070074 with_items:
Zack Williamsae17c502016-06-28 22:05:19 -070075 - "apps -s -a"
76 - "bundle:list"
Zack Williams4e5d1d22016-06-13 11:10:03 -070077 - "cordvtn-node-check nova-compute-1"
Zack Williamsae17c502016-06-28 22:05:19 -070078 - "cordvtn-nodes"
Zack Williams682450e2016-11-19 09:04:41 -070079 - "cordvtn-networks"
80 - "cordvtn-ports"
Zack Williamsba7af9e2016-06-27 17:21:09 -070081 - "dhcp-list"
Zack Williamsae17c502016-06-28 22:05:19 -070082 - "flows"
83 - "hosts"
84 - "log:display"
85 - "nodes"
86 - "ports"
87 - "summary"
Zack Williams4e5d1d22016-06-13 11:10:03 -070088
Zack Williams682450e2016-11-19 09:04:41 -070089- name: Docker diag collection - Find names for all running Docker containers
Zack Williams7bf35702017-02-08 20:40:02 -070090 command: sudo docker ps --format '{{'{{'}} .Names {{'}}'}}'
91 ignore_errors: yes
Zack Williams682450e2016-11-19 09:04:41 -070092 register: docker_containers
Zack Williams35624562016-08-28 17:12:26 -070093 tags:
Zack Williams682450e2016-11-19 09:04:41 -070094 - 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 Williams7bf35702017-02-08 20:40:02 -070098 ignore_errors: yes
Zack Williams682450e2016-11-19 09:04:41 -070099 args:
100 creates: "~/{{ diag_dir }}/docker/{{ item | regex_replace('[^\\w-]', '_')}}"
Zack Williams7bf35702017-02-08 20:40:02 -0700101 with_items: "{{ docker_containers.stdout_lines }}"
Zack Williams682450e2016-11-19 09:04:41 -0700102 tags:
103 - skip_ansible_lint # ansible-lint interprets the \n incorrectly
104