blob: 3adeca64a0b157bbcf4b5be866469a5137279045 [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 Williams682450e2016-11-19 09:04:41 -070028 - "sudo virsh list"
Zack Williams7bf35702017-02-08 20:40:02 -070029 - "sudo lxc list"
30 - "sudo docker ps -a"
Zack Williams2bfbbd62016-06-13 10:18:19 -070031
32- name: Juju diag collection
Zack Williams04106732016-06-27 20:55:32 -070033 shell: "{{ item }} > ~/{{ diag_dir }}/juju/{{ item | regex_replace('[^\\w-]', '_')}}"
Zack Williams7bf35702017-02-08 20:40:02 -070034 ignore_errors: yes
Zack Williams35624562016-08-28 17:12:26 -070035 args:
36 creates: "~/{{ diag_dir }}/juju/{{ item | regex_replace('[^\\w-]', '_')}}"
Zack Williams2bfbbd62016-06-13 10:18:19 -070037 with_items:
38 - "juju status --format=summary"
Zack Williams7bf35702017-02-08 20:40:02 -070039 - "juju status --format=tabular"
Zack Williams2bfbbd62016-06-13 10:18:19 -070040 - "juju status --format=json"
41
42- name: OpenStack diag collection
Zack Williamsc989f262017-05-11 13:02:59 -070043 shell: "source /opt/cord_profile/admin-openrc.sh && {{ item }} > ~/{{ diag_dir }}/openstack/{{ item | regex_replace('[^\\w-]', '_')}}"
Zack Williams7bf35702017-02-08 20:40:02 -070044 ignore_errors: yes
Zack Williams2bfbbd62016-06-13 10:18:19 -070045 args:
46 executable: "/bin/bash"
Zack Williams35624562016-08-28 17:12:26 -070047 creates: "~/{{ diag_dir }}/openstack/{{ item | regex_replace('[^\\w-]', '_')}}"
Zack Williams2bfbbd62016-06-13 10:18:19 -070048 with_items:
Zack Williamsa6536462016-06-13 13:13:33 -070049 - "glance image-list"
Zack Williams2bfbbd62016-06-13 10:18:19 -070050 - "nova list --all-tenants"
Zack Williams85fd3042016-06-13 13:47:58 -070051 - "nova host-list"
Zack Williams7bf35702017-02-08 20:40:02 -070052 - "nova hypervisor-list"
Zack Williams2bfbbd62016-06-13 10:18:19 -070053 - "keystone tenant-list"
Zack Williamsa6536462016-06-13 13:13:33 -070054 - "keystone user-list"
55 - "neutron net-list"
56 - "neutron subnet-list"
Zack Williams85fd3042016-06-13 13:47:58 -070057 - "neutron port-list"
Zack Williams2bfbbd62016-06-13 10:18:19 -070058
Zack Williams4e5d1d22016-06-13 11:10:03 -070059- name: ONOS diag collection - REST API
Zack Williams7bf35702017-02-08 20:40:02 -070060 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 Williams35624562016-08-28 17:12:26 -070062 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 Williams2bfbbd62016-06-13 10:18:19 -070065 with_items:
66 - "hosts"
67
Zack Williams4e5d1d22016-06-13 11:10:03 -070068- name: ONOS diag collection - ONOS CLI
Zack Williams7bf35702017-02-08 20:40:02 -070069 shell: "sshpass -p 'karaf' ssh -p 8102 karaf@onos-cord {{ item }} > ~/{{ diag_dir }}/onos/{{ item | regex_replace('[^\\w-]', '_') }}"
70 ignore_errors: yes
Zack Williams35624562016-08-28 17:12:26 -070071 args:
72 creates: "~/{{ diag_dir }}/onos/{{ item | regex_replace('[^\\w-]', '_')}}"
Zack Williams4e5d1d22016-06-13 11:10:03 -070073 with_items:
Zack Williamsae17c502016-06-28 22:05:19 -070074 - "apps -s -a"
75 - "bundle:list"
Zack Williams97bbf0b2017-08-01 22:50:08 -070076 - "cordvtn-node-check compute1"
Zack Williamsae17c502016-06-28 22:05:19 -070077 - "cordvtn-nodes"
Zack Williams682450e2016-11-19 09:04:41 -070078 - "cordvtn-networks"
79 - "cordvtn-ports"
Zack Williamsba7af9e2016-06-27 17:21:09 -070080 - "dhcp-list"
Zack Williams97bbf0b2017-08-01 22:50:08 -070081 - "devices"
Zack Williamsae17c502016-06-28 22:05:19 -070082 - "flows"
83 - "hosts"
84 - "log:display"
85 - "nodes"
Zack Williams97bbf0b2017-08-01 22:50:08 -070086 - "netcfg"
Zack Williamsae17c502016-06-28 22:05:19 -070087 - "ports"
88 - "summary"
Zack Williams4e5d1d22016-06-13 11:10:03 -070089
Zack Williams682450e2016-11-19 09:04:41 -070090- name: Docker diag collection - Find names for all running Docker containers
Zack Williams7bf35702017-02-08 20:40:02 -070091 command: sudo docker ps --format '{{'{{'}} .Names {{'}}'}}'
92 ignore_errors: yes
Zack Williams682450e2016-11-19 09:04:41 -070093 register: docker_containers
Zack Williams35624562016-08-28 17:12:26 -070094 tags:
Zack Williams682450e2016-11-19 09:04:41 -070095 - 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 Williams7bf35702017-02-08 20:40:02 -070099 ignore_errors: yes
Zack Williams682450e2016-11-19 09:04:41 -0700100 args:
101 creates: "~/{{ diag_dir }}/docker/{{ item | regex_replace('[^\\w-]', '_')}}"
Zack Williams7bf35702017-02-08 20:40:02 -0700102 with_items: "{{ docker_containers.stdout_lines }}"
Zack Williams682450e2016-11-19 09:04:41 -0700103 tags:
104 - skip_ansible_lint # ansible-lint interprets the \n incorrectly
105