blob: ed9346f02e1ed7bd62fed49df827222dfe207c7d [file] [log] [blame]
---
# head-diag/tasks/main.yml
- name: Create diag_dir fact
set_fact: diag_dir="~/diag-{{ ansible_date_time.iso8601_basic_short }}"
- name: Create diag_dir subdirs
file:
dest="{{ diag_dir }}/{{ item }}"
state=directory
with_items:
- net
- juju
- openstack
- onos
- xos
- name: Networking diag collection
shell: "{{ item }} > {{ diag_dir }}/net/{{ item | regex_replace('[^\\w-]', '_')}}"
with_items:
- "ifconfig -a"
- "route -n"
- "brctl show"
- "cat /etc/resolv.conf"
- name: Juju diag collection
shell: "{{ item }} > {{ diag_dir }}/juju/{{ item | regex_replace('[^\\w-]', '_')}}"
with_items:
- "juju status --format=summary"
- "juju status --format=json"
- name: OpenStack diag collection
shell: "source ~/admin-openrc.sh && {{ item }} > {{ diag_dir }}/openstack/{{ item | regex_replace('[^\\w-]', '_')}}"
args:
executable: "/bin/bash"
with_items:
- "nova image-list"
- "nova list --all-tenants"
- "keystone tenant-list"
- name: ONOS diag collection - REST API
shell: "curl -X GET -u karaf:karaf http://onos-cord-1:8181/onos/v1/{{ item }} | python -m json.tool > {{ diag_dir }}/onos/{{ item | regex_replace('[^\\w-]', '_') }}"
with_items:
- "hosts"
- name: ONOS diag collection - ONOS CLI
shell: "sshpass -p 'karaf' ssh -p 8101 karaf@onos-cord {{ item }} > {{ diag_dir }}/onos/{{ item | regex_replace('[^\\w-]', '_') }}"
with_items:
- "cordvtn-nodes"
- "cordvtn-node-check nova-compute-1"
- name: XOS diag collection
shell: "ssh ubuntu@xos-1 \"{{ item }}\" > {{ diag_dir }}/xos/{{ item | regex_replace('[^\\w-]', '_')}}"
with_items:
- "docker ps"
- name: Copy and run XOS docker logs script
command: "{{ item }}"
with_items:
- "scp {{ role_path }}/files/docker_logs.sh ubuntu@xos-1:~/docker_logs.sh"
- "ssh ubuntu@xos-1 'bash ~/docker_logs.sh'"
- name: XOS docker logs retrieval
command: "rsync -avP ubuntu@xos-1:~/docker_logs/ {{ diag_dir }}/xos/"