added diagnostic playbook and role
diff --git a/cord-diag-playbook.yml b/cord-diag-playbook.yml
new file mode 100644
index 0000000..2adf726
--- /dev/null
+++ b/cord-diag-playbook.yml
@@ -0,0 +1,7 @@
+---
+# Collects diagnostic information for the currently running cord-pod config
+
+- name: Diagnostics on head node
+ hosts: head
+ roles:
+ - head-diag
diff --git a/roles/head-diag/defaults/main.yml b/roles/head-diag/defaults/main.yml
new file mode 100644
index 0000000..cd21505
--- /dev/null
+++ b/roles/head-diag/defaults/main.yml
@@ -0,0 +1,2 @@
+---
+
diff --git a/roles/head-diag/tasks/main.yml b/roles/head-diag/tasks/main.yml
new file mode 100644
index 0000000..d9df5f4
--- /dev/null
+++ b/roles/head-diag/tasks/main.yml
@@ -0,0 +1,50 @@
+---
+# 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
+ 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: XOS diag collection
+ shell: "ssh ubuntu@xos \"{{ item }}\" > {{ diag_dir }}/xos/{{ item | regex_replace('[^\\w-]', '_')}}"
+ with_items:
+ - "docker ps"
+